I want to make a grid have certain columns staggered, like this:
Currently I can only get the 4th element to line up so it's below 2 (with a clear: left;
). This can be seen in a fiddle.
I'm not sure if this is possible without absolute positioning or at best relative position to the #wrapper
element. I'm not totally against ideas that need javascript
, because in fact the above jsFiddle is a very simplified version of a layout that relies on jQuery
to display properly.
HTML
<div id="wrapper">
<section>
<p>1</p>
</section>
<section id="staggered">
<p>2</p>
</section>
<section>
<p>3</p>
</section>
<section id="new-row">
<p>4</p>
</section>
<section>
<p>5</p>
</section>
<section>
<p>6</p>
</section>
</div>
CSS
section {
width: 100px;
height: 50px;
margin: 10px;
background: #FFCC66;
float: left;
}
section#staggered {
margin-top: 35px;
}
section#new-row {
clear: left;
}
#wrapper {
width: 360px;
}