! my present design**i have designed a website like this. ** 它适用于我的屏幕分辨率。底部的 div 位于背景图像的一半上方和背景图像的一半下方。我的问题是当我为更高分辨率的屏幕测试它时它看起来不一样。图像向下移动。这是我的 CSS
body
{
background: #ffffff url(../images/11.jpg) no-repeat center top 0%;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
background-size: 100% 75%;
font-family: Arial;
}
底部的 div CSS
.banner {
width: 100%;
min-height: 300px;
height: 100%;
background-color: #ffffff;
}
如何为所有屏幕尺寸设置相同。
最佳答案
你说图像向下移动,你的意思是当你滚动图像移动但你希望它静止时?如果是这样,您可以将 background-attachment:fixed;
添加到 body
的 CSS。
关于css - 如何在正文背景图片上设置div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23640206/