Yii Foundation Docs

Yii Extension for the Rapid prototyping and building library from ZURB Foundation

The Grid

The Grid lets you quickly put together page layouts for mobile devices and the desktop. You don't need two different sites - the Grid is built to create a rock-solid experience on all kinds of devices with the exact same markup.


The Basics

The grid is built around three key elements: containers, rows, and columns. Containers create base padding for the page; rows create a max-width and contain the columns; and columns create the final structure. Everything on your page that you don't give a specific structural style to should be within a container, row and column.

What you need to know is that columns don't have a fixed width: they can vary based on the resolution of the screen, or the size of the window (try scaling down this window to see what we mean). Design with that in mind.


Nesting Support

In the Grid you can nest columns down as far as you'd like. Just embed rows inside columns and go from there. Each embedded row can contain up to 12 columns.


Examples

Take this page for example - we've set up this page by containing this section in eight columns, and the sidebar in four. When the screen is larger than iPad resolution you'll see them laid out normally - smaller than that and columns become 100% width objects for mobile devices.

Below you can see how the rows and columns come together. All columns are inside a row and for this we've colored the rows and columns for visibility. You can also see how nesting works - this example is inside an eight column container, but below we have all 12 columns to use. You can nest them down quite a ways before the percentage widths become absurdly small.

.four.columns
.four.columns
.four.columns
.three.columns
.six.columns
.three.columns
.two.columns
.eight.columns
.two.columns
.one
.eleven.columns
.two.columns
.ten.columns
.three.columns
.nine.columns
.four.columns
.eight.columns
.five
.seven.columns
.six.columns
.six.columns
.seven.columns
.five.columns
.eight.columns
.four.columns
.nine.columns
.three.columns
.ten.columns
.two.columns
.eleven.columns
.one
.twelve.columns

Offsets

Offsets allow you to create additional space between columns in a row. The offsets run from offset-by-one all the way up to offset-by-eleven. Like the rest of the grid they're nestable.

.one
.eleven.columns
.one
.ten.columns.offset-by-one
.one
.nine.columns.offset-by-two
.one
.eight.columns.offset-by-three
.seven.columns.offset-by-five
.six.columns.offset-by-six
.five.columns.offset-by-six
.four.columns.offset-by-eight

Centered Columns

Centered columns are placed in the middle of the row. This does not center their content, but centers the grid element itself. This is a convenient way to make sure a block is centered, even if you change the number of columns it contains. Note: for this to work, there cannot be any other column blocks in the row.

.one.columns.centered
.two.columns.centered
.three.columns.centered
.four.columns.centered
.five.columns.centered
.six.columns.centered
.seven.columns.centered
.eight.columns.centered
.nine.columns.centered
.ten.columns.centered
.eleven.columns.centered
.twelve.columns.centered

Source Ordering

Sometimes within the grid you want the order of your markup to not necessarily be the same as the order items are flowed into the grid. Using these source ordering classes you can shift columns around on desktops and tablets. On phones the grid will still be linearized into the order of the markup.

.two.columns
.ten.columns (last)
.three.columns
.nine.columns (last)
.four.columns
.eight.columns (last)
.five
.seven.columns (last)
.six.columns
.six.columns (last)
.seven.columns
.five.columns (last)
.eight.columns
.four.columns (last)
.nine.columns
.three.columns (last)
.ten.columns
.two (last)
The syntax supports push and pull for two to ten columns, and is added directly to the columns themselves.


Mobile Grid

The grid has two modes of adapting for small displays like phones. The first requires no work at all — the grid will linearize on a small device so your columns stack vertically. This is useful to quickly adapt a desktop layout to a simple scrolling mobile layout. The other option is to use some simple classes to implement a four-column phone grid.

Four Column Mobile Grid

When you're creating your layout you can optionally attach classes that take your existing grid elements and attach them to a four column phone grid.

.three.phone-one.columns
.nine.phone-three.columns
.six.phone-two.columns
.six.phone-two.columns
.nine.phone-three.columns
.three.phone-one.columns
Mobile Source Ordering

You can use the same push and pull style classes on the 4 column phone grid. The syntax includes .pull-one-phone, .pull-two-phone, .pull-three-phone, as well as .push-one-phone, .push-two-phone, .push-three.phone.

Other Layout Options

Be sure to check out the Layout docs to see how you can turn various grid elements on and off, as well as use 2/3/4/5-up block grids for gallery style layouts.

Get Yii Foundation

Download Yii Foundation here to get started quickly. Includes everything you need to get your proyects up and running, take a look at the Setup Guide.

Download Yii Foundation

Awww yeah, modal dialog!

Yeah it's just the best.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. In ultrices aliquet placerat. Duis pulvinar orci et nisi euismod vitae tempus lorem consectetur. Duis at magna quis turpis mattis venenatis eget id diam.

× This is a Button