Zurb Foundation Columns: A Comprehensive Guide

Author

Reads 997

High-altitude aerial photo showing grid layout of Monopoli, Italy's residential district.
Credit: pexels.com, High-altitude aerial photo showing grid layout of Monopoli, Italy's residential district.

Zurb Foundation Columns are a powerful tool for building responsive and flexible layouts.

They allow you to create a grid system that adapts to different screen sizes and devices, making it easy to design and develop websites that work well on various platforms.

With Zurb Foundation Columns, you can create a variety of column combinations to suit your design needs, from simple one-column layouts to complex multi-column grids.

The default column width in Zurb Foundation is 12 columns, which can be divided into smaller units to create a more granular grid system.

Column Basics

You can create a column using the grid-column() mixin, which allows you to define the width of the column in various ways.

The grid column calculator can be accessed as a function, giving you the percentage value without any grid column CSS. To define the width of a column, you can use the grid column calculator function.

The grid-column() function provides possible values for the width of a column. You can also use the grid-column-count property to specify the width of a column, which is set to the default value of $grid-column-count.

Credit: youtube.com, Zurb Foundation Grid - CSS Grids Series (columns)

The spacing between columns is controlled by the grid-column-gutter() function, which provides possible values for the spacing. You can also use the grid-column-gutter property to specify the spacing, which is set to the default value of $grid-column-gutter.

Here's a table summarizing the properties related to column width and spacing:

The mobile grid is an awesome feature that allows you to have more control over how your layouts adapt to smaller viewports.

Column Margin

Column Margin is a crucial aspect of grid systems, and it's essential to understand how to control it.

The grid-column-margin property allows you to set the bottom margin on grid columns to match the gutters.

You can specify the bottom margin using the $margin parameter, which accepts a number or keyword value. The default value is auto.

If you want to use a map or single value, you can use the $margins parameter, which defaults to the gutter settings defined in the grid system.

Column Layout

Credit: youtube.com, Foundation Lesson 151 - Don’t Let Your Grid be a Blocker - Foundation's Block Grid

Column Layout is a powerful tool in Zurb Foundation, allowing you to create complex layouts with ease. You can use the grid-column() mixin to create a column, which gives you a number of ways to define the width of the column.

The grid column calculator can also be accessed as a function, giving you the percentage value without any of the grid column CSS. This is especially useful when you need to calculate the width of a column on the fly.

The grid-column() function is a key part of creating columns in Zurb Foundation, and it's worth noting that the width of the column can be defined in a number of different ways.

Here are some key parameters to keep in mind when creating columns in Zurb Foundation:

You can also use the mobile grid to create a four-column layout that activates with the mobile media query. This is a great way to create a layout that adapts to smaller viewports, and it's especially useful when you need to create a layout that works on a variety of different devices.

Live Demo

Credit: youtube.com, Live Demo: Creating a 10-column Responsive Grid

Foundation's live demo is a great way to see its responsive behavior in action. By default, Foundation is responsive, which means it adjusts its layout based on the screen size.

As you can see in the demo, everything gets slapped into a single column grid when the viewport becomes too narrow. This simple yet effective approach makes it easy to create a layout that works well on any device.

This single column grid layout is a great way to ensure that your content is still accessible and easy to read on smaller screens. It's a simple yet powerful solution that Foundation provides out of the box.

Advanced Techniques

In a grid layout, the class numbers only add up to the total number of columns, leaving some spots left. This is a common challenge many designers face.

One way to account for this is by using a two column offset, as seen in the example where the grid is extended to fill the remaining spots.

The class numbers can be adjusted to accommodate the offset, ensuring a balanced and visually appealing layout.

By applying this technique, you can create a harmonious and well-structured grid that effectively utilizes the available space.

Column-Row

Credit: youtube.com, 14.216 Data Layouts: Row Layout vs Column Layout

You can create a grid column row by using the class "grid-column-row" or its alias "grid-col-row()". This is equivalent to adding both .row and .column classes to the same element.

The grid-column-row class takes a parameter called $gutters, which specifies the width of the gutters on either side of the column row. The default value for $gutters is $grid-column-gutter.

You can save some markup by combining the .row and .column classes together on the same element, especially if you only have a single column. This is called a combined column/row.

Column rows can use sizing classes like .small-8, but only when used as a top-level container, not when nested inside another row.

Column Gutter

The column gutter is the space between two columns in a row, and it's responsive, meaning it gets larger on larger screens. This is a great feature for making your website look good on different devices.

You can control the column gutter by using the grid-column-gutter() function, which accepts multiple values for different breakpoints. For example, you can set the gutter size to 20px on small screens and 30px on medium screens.

Credit: youtube.com, InDesign Columns, Gutters, and Baseline Grid

The default gutter size is set by the $grid-column-gutter variable map, which you can edit in the Sass version of Foundation. To add more gutter definitions, simply add new lines to the map with the breakpoint name and gutter size.

Here's a breakdown of the default gutter sizes for different breakpoints:

To collapse or uncollapse rows, you can use the .collapse class, which removes column gutters (padding). This is useful when you want to remove the space between columns on certain screens.

The XY Grid, introduced in Foundation 6.4, is a powerful grid system that can render items both horizontally and vertically. By default, there's no gutter at all, but you can define the gutter on the grid-x element using the grid-margin-x or grid-padding-x classes.

Fluid Row

Fluid Row is a great way to make your rows more flexible. You can make a row completely fluid by adding the .expanded class.

By default, a row is always 1200 pixels wide. This is a fixed width that can be a bit limiting, especially if you're working with responsive designs. Adding the .expanded class removes this restriction, allowing the row to take up as much space as it needs.

Credit: youtube.com, Layout - Row-Columns

One thing to keep in mind with fluid rows is that they can take up a lot of space. If you're not careful, they can overwhelm the rest of your content. To avoid this, make sure to balance your fluid rows with other elements that provide some contrast.

Here are some key parameters to keep in mind when working with fluid rows:

Overall, fluid rows can be a powerful tool in your design toolkit. By allowing your rows to take up as much space as they need, you can create more dynamic and engaging layouts.

Incomplete Rows

Incomplete rows can be tricky to handle, especially when dealing with different browser rounding behaviors. Foundation solves this issue by floating the last column in a row to the right.

This ensures the edge of the last column aligns properly, but it only works if the row has a total of 12 columns. If your row doesn't meet this requirement, you can use the class .end on the last column to override this behavior.

Centered

Credit: youtube.com, Learn to decide the position of Columns in a column layout | Structural planning | Civil Tutor

Centered columns are a great way to add some visual appeal to your layout. You can center them by adding a class of .small-centered to your column.

Large columns will inherit this centering by default, but you can also center them solely on large screens by applying a .large-centered class. This is especially useful if you want to create a unique look on larger screens.

To uncenter your columns on large screens, simply use the .large-uncentered class. This will give you more flexibility in your design and allow you to create different layouts for different screen sizes.

Block

Block grids are a shorthand way to create equally-sized columns. You can add a class of the format .[size]-up-[n] to change the number of columns within the row.

By default, the max number of columns you can use with block grid is 8. This is a good starting point, but you can adjust it as needed.

Credit: youtube.com, 20. Column Layout Block

Adding the .column-block class to columns will apply a bottom margin equal to the width of gutters. This helps create a clean and consistent look.

You can also create your own custom block grid using the grid-layout() mixin. This mixin takes three parameters: the number of columns, the child element selector, and the padding value.

Here's a breakdown of the parameters:

Frequently Asked Questions

What is a foundation grid?

A Foundation grid is a structured layout system based on a grid system, allowing developers to create organized web page layouts. It uses a mobile-first approach, making it adaptable to various device sizes.

Walter Brekke

Lead Writer

Walter Brekke is a seasoned writer with a passion for creating informative and engaging content. With a strong background in technology, Walter has established himself as a go-to expert in the field of cloud storage and collaboration. His articles have been widely read and respected, providing valuable insights and solutions to readers.

Love What You Read? Stay Updated!

Join our community for insights, tips, and more.