html - How to use divs instead of tables -
i trying create following table layout, want use div instead of table:
------------------ | | | | cell1 | cell2 | | | | | |--------| | | | | | cell3 | | | | ------------------
i want height of cells set content (i.e. no height: style)
i have tried using float:left on cell1, can't seem cells 2 , 3 behave.
edit js fiddle here: http://jsfiddle.net/utzr3/
html:
<div class="list-row"> <div class="list-left">cell1 </div> <div class="list-right"> <div class="list-title">cell2</div> <div class="list-filters">cell3 </div> </div> </div> <div class="list-row"> <div class="list-left">cell1 </div> <div class="list-right"> <div class="list-title">cell2</div> <div class="list-filters">cell3 </div> </div> </div> <div class="list-row"> <div class="list-left">cell1 </div> <div class="list-right"> <div class="list-title">cell2</div> <div class="list-filters">cell3 </div> </div> </div>
css:
.list-row { background:#f4f4f4; border:2px solid red; } .list-left { width:auto; padding:10px; top:0px; left:0px; border: 2px solid blue; } .list-right { top:0px; left:60px; padding:10px; border:2px solid green; } .list-title { font-size:18px; padding:8px; } .list-filters { padding:8px; }
you need inline-block
, float
: here's jsfiddle
.list-row { background:#f4f4f4; display:inline-block; border:2px solid red;} .list-left { width:auto; padding:10px; float:left; border: 2px solid blue;} .list-right { padding:10px; float:right; border:2px solid green;}
also, since you're not using relative
or absolute
positioning, don't need specify top
, left
.
Comments
Post a Comment