全屏圖像中有twitter.In源代碼的頭版一個完整的畫面,他們做這樣的事情:爲什麼嘰嘰喳喳實現這樣
HTML:
<div class="front-bg">
<img class="front-image" src="xxx.jpg">
</div>
CSS:
.front-bg {
position: fixed;
width: 200%;
height: 200%;
left: -50%;
}
.front-bg img {
margin: auto;
min-width: 50%;
min-height: 50%;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
爲什麼他們將top/left屬性設置爲「.front-bg img」? 如果我改變這樣的:
.front-bg {
position: fixed;
width: 100%;
height: 100%;
}
.front-bg img {
min-width: 100%;
min-height: 100%;
}
它的工作原理也是如此。爲什麼他們將寬度設置爲200%?
我也這麼認爲..但嘗試上面提到的編輯和調整兩個版本的窗口大小似乎具有相同的效果。 – dev 2013-02-22 15:06:52
我的最佳猜測是,儘管編輯後的代碼可能在您的瀏覽器上運行,但可能會有舊的瀏覽器無法正常工作,這是爲了糾正錯誤。 – 2013-02-22 17:44:37
你們可以在舊的瀏覽器上做一些測試嗎?我來自中國。由於那些共產主義混蛋,它使用ietester很難訪問嘰嘰喳喳。 – Chef 2013-02-23 10:54:48