【发布时间】:2018-05-19 20:35:25
【问题描述】:
我目前正在定位一个高度较小但宽度较大的背景图像,以便在浏览器中一直延伸。我只有在做背景尺寸封面时才能做到这一点,但当我为封面以外的图像设置一定的尺寸时不能做到这一点。我尝试了后台重复-x,但这似乎也不起作用。
<html>
<body>
<div class="background">
<div class=“header”></div>
//some content
</div>
<footer><footer/>
</body>
</html>
CSS
.background {
background-image: url(some image);
background-size: //tried cover and it works but not when I set it to width 100% or something like 2800px
background-repeat: repeat-x;
background-position-y: bottom;
}
html, body, .background {
height: 100%;
}
【问题讨论】:
-
我为什么投了反对票?
-
您没有提供有效的 html 供我们测试
-
请更新 html 部分并提供正确的 html(带有正确的标签),以便可以帮助解决问题。