I currently have a list of hexagons (images) that I have wrap to the next line when the browser width decreases. However, when this happens, they form even lines as seen in the first image, each starting at the same point on the x axis.
Here is the JS Fiddle (albeit, the hexes don't flow right because they aren't images). The real code for this is:
<div class="container">
<span>
<img class="hex" src="img/hex.png">
</span>
...
</div>
And the CSS is:
.container {
padding-top: 80px;
width: 50%;
margin-left: auto;
margin-right: auto;
}
.container span {
line-height: 129px;
display: inline-block;
}
.container .hex {
display: block;
margin-left: auto;
margin-right: auto;
}
What I would like to do is alternate the rows such that every other row starts at an offset of the hexagon size as seen in figure two. It should also be noted that this example also has a negative y position relative to the respective position as determined from the first image.
Is there a way to do this with just CSS? I'd like to avoid using a library if at all possible.
This is similar to the question asked here, but I need the entire structure to be able to have an undetermined number of rows, so the solution where I specify which items are in which rows isn't feasible for my application.