2017-02-16 141 views
0

this page,我希望div.bouble_shaded_bg_full-width成爲瀏覽器寬度的100%。打破一個固定寬度的div div寬度變爲100%

我曾嘗試以下CSS,但這不能正常工作,推動DIV頁面的一面:

.bouble_shaded_bg_full-width { 
    margin-left: calc(((100%-1140px)/2)*(-1)); 
    margin-right: calc(((100%-1140px)/2)*(-1)); 
} 

,其中主要內容區1140px寬。

我該如何製作div.bouble_shaded_bg_full-width如果瀏覽器的寬度是固定寬度div的100%

回答

0

下面應該這樣做,刪除您當前的右/左邊距。

.bouble_shaded_bg_full-width { 
    width:100vw; 
    position:relative; 
    left:50%; 
    margin-left:-50vw; 
} 
+0

作出這個改變,感謝李,但[已經使div左右50%左右](http://freightplus.com/beta/about-us/)。 – Steve

+0

刪除'float:left' – Lee

+0

完成,Lee,問題仍然存在 – Steve

0

嘗試100vw,這將是視口寬度的100%。

+0

謝謝virhonestum,但顯示保持不變。 – Steve