Book Image

Getting Started with Zurb Foundation 4

By : Andrew D. Patterson
Book Image

Getting Started with Zurb Foundation 4

By: Andrew D. Patterson

Overview of this book

<p>Every web designer needs a toolkit. From text editors to graphics programs, from table structures to fluid style sheets, the web designer has many tools and techniques to choose from. Zurb's Foundation framework is an excellent kit for today's web designer. It's fluid, it's easy to work with, it has plenty of components, and most importantly, you can apply your creativity to make your very own designs.<br /><br />Zurb's Foundation 4 is a practical, easy-to-use toolkit for the layout and construction of web pages. Getting Started with Zurb Foundation 4 introduces Zurb Foundation’s powerful web design and development toolkit. Learn how to create professional layouts with ease, add powerful CSS and JavaScript components to your pages, and then customize and configure the design to your satisfaction. Understand how to efficiently manage your CSS and layout your pages with SASS, the style sheet language. This book will help you put Foundation 4 to work for you today!<br /><br />This book documents Foundation's grid system, all its components and plugins, and its generation of custom style sheets. The book serves as an all-encompassing introduction as well as a future reference guide. The foundation of Foundation is its grid system...and there is a whole lot more.<br /><br />Once you've covered the basics, you'll be ready to advance with SASS, the style sheet language, to customize your installation and layout your pages.<br /><br />With this book, you will discover all the CSS components and JavaScript plugins that are included in Foundation at the present time and learn how to integrate each of them into your web pages.</p>
Table of Contents (11 chapters)

Working with cells, rows, and columns


The foundation (pun intended) of Zurb Foundation is its grid system—rows and columns, much like a spread sheet, a blank sheet of graph paper, or tables similar to what we used to use for HTML layout. Think of it as the canvas upon which you design your website.

The following is a way to picture a blank grid before you begin your design:

Each cell is a content area that can be merged with other cells beside or below it to make larger content areas. A default installation of Foundation will be based on 12 cells in a row. This is convenient because the number 12 is divisible by 1, 2, 3, 4, 6, and 12.

The following is the grid again with the cells in a row grouped into 12, 6, 4, 3, 2, and 1 columns respectively:

A column is comprised of one or more individual cells in a row. The total width of the columns in a row cannot exceed the number of underlying cells in the grid's row.

The following figure is an example of a typical blog layout:

How do we create these areas for our website? We simply define rows and columns using HTML. The following is the HTML code for the header row in the example blog:

<div class="row">
  <div class="large-6 column">
    <!-- Header left -->
  </div>
  <div class="large-6 column">
    <!-- Header right -->
  </div>
</div>

The outer <div> tells the browser to form a block representing a row. It gives that block all the styles associated with a row class. Each inner <div> tells the browser to form a block representing a column within the row where each column has a width of 6 cells. As our grid has 12 cells in a row, each column with six cells is 50 percent of the row width.

Foundation styles look after keeping the two columns in one row and making them equal in width. We'll cover the small-n and large-n classes in more detail further on. In this example, specifying each column as large-6 means that it will use six cells on a regular display.

From this, you can write the HTML for the content and footer rows in our sample blog. Each will be a row. The content area has two columns, of which one is eight cells wide and the other is four cells wide. The footer area has three columns, each being four cells wide.