我有一個背景圖像居中,鉻顯示偏移一個像素。背景中心與鉻(bug)
CSS
#container {
background: url("images/header.jpg") no-repeat scroll 50% transparent;
width: 100%
}
#header {
width: 986px;
margin: 100px auto 0 auto;
}
HTML
<html>
<body>
<div id="container">
<div id="header">centered content</div>
</div>
</body>
</html>
我猜它與瀏覽器如何處理不同的center
-or 50%
做的事情 - 在CSS中background
的屬性:
是否有已知的(simple)黑客或替代方法來解決這個問題?背景容器具有爲100%寬。
整潔!媒體查詢是關鍵,但在我的情況下,代碼是:@media screen和(-webkit-min-device-pixel-ratio:0){#container {background-position:49.9%top; }}'(如果可以的話,改變答案) –