2013-03-04 70 views
-1

我已經包含橫幅圖像。在我的一個代碼中,它可以正常工作,但是當我在另一個代碼中包含相同的橫幅時,它無法正常工作。你能告訴我原因嗎?在我的新代碼中,我看到了橫幅外的空白區域。橫幅圖像應該有寬度100%

http://jsfiddle.net/rajkumart08/y88WX/29/embedded/result/

.home .hero-unit { 
    background: none; 
    height: 318px; 
    padding: 1px 620px 0 0; 
    margin-right: -100px; 
    margin-left: -100px; 
    margin-bottom: 0; 
    background: url("http://www.defie.co/designerImages/defie_landing_page.png") right bottom no-repeat; 
} 

.hero-unit { 
    padding: 60px; 
    margin-bottom: 30px; 
    background-color: #eee; 
    -webkit-border-radius: 6px; 
    -moz-border-radius: 6px; 
    border-radius: 6px; 
} 
+0

100%的英雄單位或100%的整個屏幕? – penner 2013-03-04 19:49:57

回答

0

.hero單元只有1250px和你的背景圖像是容器內聲明。尷尬的利潤率是文字不會疊加在圖像上的原因。在實際上是屏幕100%的div中定義背景。此外,請注意.container不是屏幕的100%。創建一個包含容器和您的.hero單元與背景圖像的新div。

0

刪除被您所包裹你的「.hero單元」中的「.container」選擇設置寬度。

或者你可以嵌套你的「.hero單元內「.container」 '

<div class="hero-unit'> 
    <div class="container"> // Banner text etc </div> 
</div><!-- /hero-unit -->