我对图像在 Safari 上的位置有疑问 this page .
首先,在 Chrome、Firefox 和 Internet Explorer 上,结果是正确的:
但是在 Safari 上有一个问题:
有 CSS :
span.boy_hand {
background:url(../img/hand_png.png) no-repeat;
height:35px;
width:51px;
position:fixed;
top:470px;
margin-left:-32px;
}
你能告诉我它是从哪里来的吗?
最佳答案
只需使用 left 属性而不是 margin-left 来将图像设置在正确的位置。 不同的浏览器将猜测位置固定元素的差异。因此最好的做法是为您的元素包含 left 和 top 属性
span.boy_hand {
background:url(../img/hand_png.png) no-repeat;
height:35px;
width:51px;
position:fixed;
top:470px;
left:32px; /* Set left property as per your need,I just simple reused your code */
}
关于CSS 和 Safari : image position,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23262628/