Nel seguente codice HTML, div .left e .right hanno altezze diverse. È possibile rendere entrambe le div stesse della stessa altezza senza definire l'altezza. Ho provato a usare display: table ma non funziona.CSS che creano due div all'altezza con tabella di visualizzazione
HTML:
<div class="wrap">
<div class="left">
Lorem
</div>
<div class="right">
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</div>
</div>
CSS:
.wrap{
overflow:hidden;
width:250px;
display: table;
border-collapse: collapse;
}
.left{
width:100px;
float:left;
display: table-cell;
border-bottom:1px solid green;
}
.right{
width:150px;
float:left;
border-bottom:1px solid red;
display: table-cell;
}
jsfiddle: http://jsfiddle.net/fJbTX/1/
Non hai bisogno di un div con 'display: table-row', il browser lo aggiungerà. http://stackoverflow.com/questions/22179502/is-it-valid-to-use-css-table-cell-with-no-table-row – lefoy
Se float viene aggiunto da qualche altra parte nel foglio di stile. Puoi aggiungere al tuo .left e .rigth divs la proprietà 'float: none' per cancellare l'effetto di quel float. – Mohsin