2013-08-02 97 views
0

定位全寬標題。我希望它能出現這樣的事情。 http://meem.co.vu/定位全寬標題

事業部:

<div id="shell"> 

<div class="img"><img src="http://static.tumblr.com/ydsgqx5/f28mqvumo/waterfall-nature-wallpaper.png" width="448" height="336" alt="" /></div> 
<div id="msg"></div> 

</div> 

的CSS:

#shell { margin:0; 
padding:30px; 
width:600px; 
height:400px; 
background:#eee; } 
div.img { width:360px; 
height:280px; 
overflow:hidden; 
margin:auto; 
} 
#banner { 
width: 960px; 
height: 400px; 
margin: 0 auto 30px; 
overflow:hidden; 
float: left; 
} 
#banner img { 
left: 0; 
top: 0; 
position:absolute; 
} 

其它鏈接:http://jsfiddle.net/BeCF9/55/

我似乎無法獲得在屏幕上的形象佔據整個頁面。

我該如何做到這一點?

謝謝。

+0

你試過 '#banner img {left:0;正確:0; top:0;位置:絕對; }' – jstwrt

回答

0

檢查的jsfiddle

http://jsfiddle.net/BeCF9/58/

#shell { margin:0; background:#eee; } 
div.img { width:100%; overflow:hidden; margin:auto; border:1px solid #333; } 

檢查的屏幕截圖,其中集div.img至100%也覆蓋IMG寬度爲100%。

希望下面的截圖看起來就像是你想要的 enter image description here

+0

我試過了,沒有工作。還是有差距。 http://static.tumblr.com/ydsgqx5/K94mqvx99/1a5afd57b54401bf3ee8351b0372d5e6.png – Lauren

+0

是您的網站託管public..so我可以看看,並找到確切的rson –

+0

我已更新我的答案..你可以看看 –

0

我meem.co.vu的主人!

首先,我很高興,你欣賞我的標題的設計。由於我不再使用您引用的特定網站佈局,因此人們可能無法獲得您想要提問的內容。

我在屏幕上顯示的標題是全尺寸的,在CSS中是width: 100%;。爲了讓背景也保持全尺寸,我將background-size: cover;添加到CSS。我希望這有幫助。 :)