【发布时间】:2012-11-19 11:59:08
【问题描述】:
我在我的网站上有一个使用background-size:cover 的照片背景。它在大多数情况下都有效,但在我的 Galaxy S3 纵向模式下会留下一个奇怪的约 30 像素的空白区域。
我附上了截图。 1px 青色线是为了说明整个屏幕。似乎背景在社交媒体uls 之后立即停止。
我通过删除ul 和背景将它自己附加到标语文本的底部进行了测试。
另外,这是我与移动端肖像视图相关的 CSS:
@media only screen and (max-width: 480px) {
.logo {
position: relative;
background-size:70%;
-webkit-background-size: 70%;
-moz-background-size: 70%;
-o-background-size: 70%;
margin-top: 30px;
}
h1 {
margin-top: -25px;
font-size: 21px;
line-height: 21px;
margin-bottom: 15px;
}
h2 {
font-size: 35px;
line-height: 35px;
}
.footer_mobile {
display: block;
margin-top: 20px;
margin-bottom: 0px;
}
li {
display: block;
font-size: 1.3em;
}
这以前不会发生,但我想我在尝试解决另一个问题时不小心弄错了它。
【问题讨论】:
-
HTML,背景图片的CSS?
-
CSS 是 'html { background: url(../images/bg.jpg) no-repeat top right fixed; -webkit-background-size:封面; -moz-background-size:封面; -o-background-size:封面;背景尺寸:封面; } '
-
只是几个猜测:你试过
html { height: 100% },还是尝试将背景附加到body而不是html? -
html { height: 100%} 解决了这个问题,但是出现了一个新问题——现在横向模式只覆盖了一半。随意看看..vitaliyg.com
标签: html background media-queries css