html - CSS float divs left to right underneath each other -
i want float divs left right underneath each other sort of this:
1 2 3 4
but is:
1 2 3 4
does know how properly? thanks
make wrapper div , let inner divs touch each other fragment:
html:
<div> <div>1</div> <div>2</div> <div>3</div> <div>4</div> <div>5</div> <div>6</div> </div>
css:
body > div { background: lightgreen; width: 99px; overflow: auto; } div > div { width: 50px; height: 50px; } div > div:nth-child(2n-1) { background: lightyellow; float: left; } div > div:nth-child(2n) { background: lightblue; float: right; }
Comments
Post a Comment