Laying out a grid in WordPress

For a recent project, I needed to lay items out in a series of grids, sometimes three columns, sometimes more. The CSS provided by the designer looked something like this:

.columns section {
float: left;
margin-left: 20px;
width: 220px;
.columns {
clear: left;
margin-left: 0;

I could have used jQuery, or some of the more advanced CSS selectors, to achieve this, but here’s what I created as a custom WordPress template tag. Continue reading Laying out a grid in WordPress