A jQuery plugin that adds classes to items floated in a grid style. The following classes are added: topRow, bottomRow, firstInRow, lastInRow (the class names themselves may be altered). Why not :nth-child() selectors? This plug-in re-configures on window re-size to accommodate flexible grid layouts.
$(grid-item).gridClasses();
Here is a Fiddle with an example: http://jsfiddle.net/dchaffin/h96uB/7/.