2014-01-13 55 views
0

我一直在這裏尋找一些時間,仍然無法找到解決我的問題。Div無法與高度自動或100%

我試圖建立一個網站,我有1個主div與2 div製作2列,問題是:我想要主div從它們識別高度和自動調整,以保持它的完美。但我的主要div只是忽略了一切,我的網站變得奇怪。

而且,這裏是我的測試頁面,所以你可以看到我在談論:http://dayzsa.bl.ee/

這裏是我到目前爲止的代碼:

CSS 
body {margin:0; } 
div.header { 
    width:100%; 
    height:90px; 
    margin:0; 
    background:#CCC;} 

div.content { 
    width:100%; 
    height:100%; 
    min-height:350px; 
    max-height:500px; 
    margin:0; 
    border-bottom:1px dotted #000; 
    background:#999; } 

div.footer { 
    background:#333; 
    width:100%; 
    height:100%; 
    max-height:250px; 
    min-height:200px; 
    margin:0; } 

div.content-company { 
    width:100%; 
    min-width:900px; 
    max-width:1400px; 
    margin:0 auto; 
    height:100%; 
    padding:25px 15px; 
    background:#C90; } 

div.content-company-left { 
    width:51%; 
    padding:0 25px; 
    height:100%; 
    float:left; 
    text-align:justify; 
    background:#300; } 

div.content-company-right { 
    width:45%; 
    height:100%; 
    float:left; 
    background:#F6F; } 

HTML 

<div class="header"><!-- menu goes in here --></div> 
<div class="content"> 
    <div class="content-company"> 
     <div class="content-company-left"> 
    <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p> 
    </div> 
    <div class="content-company-right"><img src="img.png" border="none" width="100%" /></div> 
    </div> 
</div> 
<div class="footer"><!--footer goes in here --> 

如果有人知道如何幫我,我謝謝你。

回答

0

使用overflow:auto在類.content-company中。

0

添加浮在你的主DIV + CSS規則:

div.content-company { float:left } 

,也沒有必要添加height:100%