gpt4 book ai didi

css - 如果浏览器高度大于 1080 像素,则移除背景图像

转载 作者:太空宇宙 更新时间:2023-11-04 13:21:02 25 4
gpt4 key购买 nike

如果浏览器高度大于 1080 像素,我想弄清楚如何删除图像。例如,当页面加载和我的图像加载时,Android 设备将超过 1080,它下降到页面的大约 2/3,其余部分为空白。我宁愿它完全消失。我怎样才能摆脱它。这是我的设置方式:

body {
font-family: Helvetica;
font-size: 1.8rem;
background-color: #000;
margin: 0 auto;
background-image: url("../images/myimage.jpg");
background-repeat:no-repeat;
background-position:center top;
background-position:no-repeat;
background-attachment:fixed;
}

我尝试过的

@media screen and (min-height: 1080px) {
body {
background-image: none;
}
}
@media device and (orientation: portrait) and (min-height: 1080px) {
body {
background-image: none;
}
}

最佳答案

尝试媒体查询!

/* standard*/
@media screen and (min-height: 1080px) {
body {
background-image: none;
}
}
/* orientation */
@media device and (orientation: portrait) and (min-height: 1080px) {
body {
background-image: none;
}
}

关于css - 如果浏览器高度大于 1080 像素,则移除背景图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24072777/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com