2012-02-26 61 views
0

繼承人的網站:http://designobvio.us/portfolio/body.html如何使背景圖片調整時瀏覽器重新調整

我試過CSS3,%基礎。似乎無法得到這個背景圖像縮放時,瀏覽器調整大小

我試圖模仿這種佈局:http://www.googlezeitgeist.com/en/top-searches/rebecca_black

HTML:

<section class="bodySection"> 
<div id="body-wrapper" class="class=""> 
    <div id="me"></div> 
    <div id="pattern"></div> 
</div> 
<div class="clearfix"></div> 
</section><!--end of bodySection--> 

CSS

html, body, #body-wrapper, .bodySection {height: 100%;} 
#body-wrapper{ 
position: relative; 
width:43%; 
height: 100%; 
} 
#body-wrapper #me{ 
position: absolute; 
top: 0; 
left: 0; 
height: 100%; 
width: 100%; 
background: url('http://designobvio.us/portfolio/img/Me.jpg') repeat-y; 
z-index: 1; 
-o-background-size:99% auto; 
-webkit-background-size:100% auto; 
-moz-background-size:99% auto; 
background-size:100% auto; 
    -webkit-transition: all 0.20s ease-out; 
    -moz-transition: all 0.20s ease-out; 
    -o-transition: all 0.20s ease-out; 
    transition: all 0.20s ease-out; 
} 
#body-wrapper #pattern{ 
position: absolute; 
top: 0; 
left: 0; 
height: 100%; 
width: 100%; 
background: url('http://designobvio.us/portfolio/img/sliderBG.png') repeat; 
z-index: 2; 
} 

我會也喜歡看到收縮或增長的緩解;很確定這可以通過轉換web工具完成,但它只是找到並將其放在正確的位置。我試過各種方法來調整大小。我老實說只是猜測和檢查。

謝謝你的時間!如果你最需要的東西只是要求

回答

3

你打電話給你的身體min-widthmin-height。擺脫他們,它工作得很好。

編輯:你不需要過渡屬性,調整大小本身流利。並保持一致!或者,您爲所有瀏覽器製作背景圖片100%或全部99%。這將爲你節省很多時間,當你有一個小的差異,你不能找到它在哪裏。

+0

感謝亞非常 – 2012-02-26 22:08:10

0

試用:

background-size: cover;