Php – div layout format php


i am trying it get that div displaying 5 in a row and then start a new line and display more

atm all that is happening is the are going under each other.


 < div>Line1< br />Line2< br>Line3< /div>

Thank you

Best Solution

If you want five divs side-by-side per line, the following works:

.cell { padding:0; margin:0; float:left; width:20%; }
.clear { clear:both; }


<div class="cell">1</div>
<div class="cell">2</div>
<div class="cell">3</div>
<div class="cell">4</div>
<div class="cell">5</div>
<div class="cell">6</div>
<div class="cell">7</div>

<div class="clear"></div>

For best results, all divs should have the same height. If they don't, you should place the <div class="clear"></div> after every 5th div.