I have 5 containers:
<div class="wrapper">
<div id="container-1"></div>
<div id="container-2"></div>
<div id="container-3"></div>
<div id="container-4"></div>
<div id="container-5"></div>
</div>
I'm trying to float the first 3 containers to the left, and the last 2 to the right (starting next to the first one floated left, on top)
currently I only achieved to float the first 3 to the left, and the last 2 to the right, but starting next to the last, floated left container and not to the top one.
Fiddle:
html,
body {
margin: 0;
padding: 0;
}
.left,
.right {
width: 40%;
height: 100px;
float: left;
clear: left;
background: red;
margin: 5px;
}
.right {
float: right;
clear: right;
background: green;
text-align: right;
}
<ul>
<li>div's are dynamic so left/right divs will be added, so unable to fixed position them in html</li>
</ul>
<div class="left"></div>
<div class="left"></div>
<div class="right"></div>
<div class="left"></div>
<div class="right"></div>
<div class="left"></div>
Expected result should be e.g.
1 - 3
2 - 5
4 - /
6