2014-01-22 50 views
0

我有這樣的事情:如何擴展divs?

<div class="wrap"> 
    <div class="first">Example</div> 
    <div class="second"> 
     <div class="inner"></div> 
    </div> 
</div> 

「包裝」具有寬度(100%或1000像素)

「內」有高度和底部邊框

我想擴大「第一」和「第二」這樣的

|==================== 1000px or 100% ======================| 

Example_____________________________________________________ 

如果我添加寬度爲「第一」,「第二」,它看起來罰款:

|==================== 1000px or 100% ======================| 

Example_____________________________________________________ 

但如果示例文本改變時間越長,包裝:

|==================== 1000px or 100% ======================| 

Another_____________________________________________________ 
Example 
and 
text 

但是,如果「第一」,「第二」沒有寬度「二是無形的:

|==================== 1000px or 100% ======================| 

Example 

怎麼做?

編輯:

從這個:

Expand a div to take the remaining width

它的工作原理,例如:

<html> 
<head> 
<style type="text/css"> 
div.box { background: #EEE; height: 100px; width: 500px; } 
div.left { background: #999; float: left; height: 100%; width: auto; } 
div.right { background: #666; height: 100%; } 
div.clear { clear: both; height: 1px; overflow: hidden; font-size:0pt; margin-top: -1px; } 
</style> 
</head> 
<body> 
<div class="box"> 
    <div class="left">Tree</div> 
    <div class="right">View</div> 
    <div class="clear" /> 
</div> 
</body> 
</html> 
+0

對不起,我沒有得到它。你能擴展最後兩行嗎? –

+0

或提供小提琴? –

+0

這是你需要的http://jsfiddle.net/8d3ZV/1/ –

回答