Creating Grids

There is a special widget that we can use to create CSS grids, as we have seen in a previous chapter. To do so, we need to use an HTML element with children and convert it to a grid of n columns based on the number of children.

To use it, we just call the grid jQuery function, for example:

$("#element").grid();

Based on how many children it has, it applies the right ui-grid-<letter> class to the element and the ui-block-letter to the children.

Get jQuery Mobile: Up and Running now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.