我网站 (dorinart.com) 上的标题图片在所有浏览器(包括安卓移动浏览器)中的位置都非常完美,但是当我在 IOS(iphone、ipad)上打开它时,它只显示图片的右上角(您可以查看如果您打开 dorinart.com)。我该如何解决这个问题?
我的 CSS 是这样的:
.header{
background: url('../img/banner5.jpg');
background-repeat: no-repeat;
position: fixed;
background-size: cover;
min-height: 730px;
position: relative;
}
最佳答案
你能试试这个 CSS 吗?我想你想让图像在可用空间中居中,对吗?如果这有效,请告诉我:
.header{
background-image: url('../img/banner5.jpg');
background-repeat: no-repeat;
background-size: cover;
background-position-x: center;
min-height: 760px;
position: relative;
}
如果您不希望它居中,则只需删除 background-position-x
属性即可。
希望这对您有所帮助。谢谢。
更新:附上来自模拟器的截图:
关于html - IOS 上的标题图像放置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43065247/