2012-02-02 51 views

回答

0

目前還不清楚到底是什麼導致你希望實現的。但是,通過爲每個元素添加一個像素width(它加起來小於或等於容器寬度),將會阻止您看到的包裝。

http://jsfiddle.net/HtAJw/10/

HTML:

<div class="parent"> 
    <div class="child"> 
     <fieldset> 
       a 
     </fieldset> 
    </div> 
    <div class="child" > 
     <div class= "newChildLeft"> 
       a <br/> b<br/> b<br/> b<br/> 
     </div> 
     <div class= "newChildRight"> 
       b<br/> b<br/> b 
     </div> 
    </div> 
</div> 

CSS:

.parent { 
    width: 100px; 
    display: table; 
    border: 1px solid green; 
    height: 100% 
} 
.child { 
    background: blue; 
    display: table-cell; 
    height: inherit; 
    width: 50px; 
} 
.newChildLeft { 
    float: left; 
    width: 25px; 
} 
.newChildRight { 
    float: right 
    width: 25px; 
} 
.child + .child { 
    background: red; 
    width: 50px; 
} 
fieldset { 
    height: 100%; 
    background-color: #666; 
    width: 50px; 
} 
相關問題