我的叠加层是背景上方的半透明背景,当您将屏幕从纵向旋转到横向时,无法正确显示。
不确定如何解决此问题。
$primary-color: #313030;
$secondary-color: #d4fe01;
$show-home-image: true;
$home-image: url(../img/background.jpg);
$background-opacity: 0.8;
@mixin easeOut {
transition: all 0.5s ease-out;
}
// hmm
@mixin background {
@if $show-home-image {
&#bg-img {
background: $home-image;
background-attachment: fixed;
background-size: cover;
&:after {
content: "";
position: absolute;
top: 0;
right: 0;
width: 100%;
height: 100%;
z-index: -1;
background: rgba($primary-color, $background-opacity);
}
}
}
}
覆盖该网站的网站:https://audreysmonsters.com
答案 0 :(得分:0)
当屏幕方向与CSS横向对齐时,可以应用其他样式。建议您在横向放置并通过媒体查询器移动时,在伪元素之后增加身高。
@media only screen and (max-width: 812px) and (orientation: landscape){
#bg-img:after{
height: 120%;
}
}