Learn how to write the code required to bridge two rows in Foundation
Most CSS grids — Foundation included — organize layout into rows that are, in turn, divided into cells or columns. But what if you want a column to extend over two rows? Officially, you’re stuck. But if we redefine the problem, a solution appears. Here’s a how you can (appear to) extend Foundation columns past one row in three minutes.
Most CSS grids — Foundation included — organize layout into rows that are, in turn, divided into cells or columns. But what if you want a column to extend over two rows? Officially, you’re stuck. But if we redefine the problem, a solution appears. Here’s a how you can (appear to) extend Foundation columns past one row in three minutes.
1. Set up a row with columns.
In this example, we’ll use two quarter-columns and a half.
2. Put two rows inside of the third column.
Start by adding a row to the last column.
Then give each inner row one column apiece.
3. Repeat for every column you don’t want
It may feel backwards, to change every column you except the one you wanted to “stretch.” But stay with us.
How it works
This uses a little sleight of hand. Instead of making one column step across rows, other columns sub-divide. From the users’ perspective, though, the design seems to have gained a long center column. It all happens through the magic of nesting.
Nesting is when one type of element resides in another element of the same type. For example, Foundation’s grid is divided into rows each row is divided into columns which, in turn, can hold rows that hold columns that can hold rows … .
As you might guess, nesting gets complicated when abused. Preserve your sanity. Don’t sub-divide too many levels.
About the instructor
Ben Gremillion is a Design Writer at ZURB. He started his career in newspaper and magazine design, saw a digital future, and learned HTML in short order. He facilitates the ZURB training courses.
Learn Foundation from the creators in our interactive online webinars which will keep you up to date with the latest trends and skills needed to win your projects.