我試圖使用CSS3背景大小來適合頁面高度的背景,但它只適用於寬度,但不適用於高度。背景大小不適合元素
我打算讓這個背景圖像適合100%的頁面寬度和高度,即使在打破它的比例時,我也沒有看到問題,因爲我使用background-size:100%100%;和
The percentage is relative to the width or height of the area given by 'background-origin'
(任何背景,出身值改變不了什麼)
我需要了解爲什麼我不能使背景的高度,以適應<body>
一些提示?我怎麼能這樣做?
這裏是我的CSS的一部分:
html {
height:100%;
min-height:100%;
}
body {
min-height:100%;
margin:0;
padding:0 2em;
background:#474747 url(../images/bg.jpg) 100% 0 no-repeat;
background-size:100% 100%; /* raaaaaah */
font-family:Cambria,serif;
min-width:910px;
position:relative;
}
提前感謝!
編輯:您可以http://matthecat.com/v2/blog.html
我不能使用固定的背景,因爲滾動發生滯後。 – MatTheCat 2011-03-30 13:23:08