2012-07-11 20 views
1

我正在使用克里斯科伊爾的全寬黑客在我正在建設的網站上,但難住我如何能讓div有無論它包含的高度。沒有使用克里斯科伊爾全寬hack的高度

通常我會通過在容器中添加overflow:auto來實現這一點,但如果我這樣做,它會破壞黑客行爲。是否有可能達到身高並仍然使用這種黑客?

你可以看到我的問題就在這裏:http://beta.revival.tv/

這裏是我的CSS:

#content-wrap:before, #content-wrap:after {content: ""; position: absolute; top: 0; bottom: 0; width: 9999px;} 

#content-wrap:before {right: 100%;} 

#content-wrap:after {left: 100%;} 

#content-wrap, #content-wrap:before, #content-wrap:after {background:#666;} 

#content-wrap { 
position: relative; 
width:1000px; 
margin:0 auto; 
padding:25px 0; 
} 

回答

2

您可以添加另一個div來包含內容的#內容包裝div中,然後應用溢出:汽車;和寬度:100%;它

<div id="content-wrap"> 
    <div id="content"></div> 
</div> 

#content { 
    overflow: auto; 
    width: 100%; 
} 

我不知道你的HTML,但如果問題是由浮動的div中的元素引起的,你還可以嘗試使用顯示嘗試:inline-block的;而不是