Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Spacing between grid cells in Zurb Foundation 4

Spacing between grid cells in Zurb Foundation 4

Problem

Is there an easy way to have spacing between the grid cells in Zurb Foundation 4? I don't want to mess with the CSS of the Foundation elements as that may throw something else off. There's a $column-gutter SCSS variable in their Grid docs:

$column-gutter: 1.875em !default;

However, I'm not sure what that's for as I have seemingly zero space between columns, not 1.875em. Am I expected to just make sure all content within the cells have padding around them?

Problem courtesy of: at.

Solution

Try to use a separate stylesheet that is loaded after the foundation.css where the content looks something like this:

@media only screen {
  .row .columns, .row .column {
    padding-left: 10px; /* change the values to anything that you want */
    padding-right: 10px;
  }
}

I put it in the @media only screen since for printing you might not want to have it display with the extra padding.

Example of this here

If you want to use this extra padding while printing you have to use the following:

.row .columns, .row .column {
  padding-left: 10px !important; /* change the values to anything that you want */
  padding-right: 10px !important;
}

You have to use the important part since there's a @media only screen in the default foundation.css that will override your values.

EDIT

Just use another separate class for the columns that you want the extra padding applied to. Example:

.extra-padding {
  padding-left: 10px !important; /* change the values to anything that you want */
  padding-right: 10px !important;
}

Example of this here

Solution courtesy of: emilhem

Discussion

View additional discussion.



This post first appeared on CSS3 Recipes - The Solution To All Your Style Problems, please read the originial post: here

Share the post

Spacing between grid cells in Zurb Foundation 4

×

Subscribe to Css3 Recipes - The Solution To All Your Style Problems

Get updates delivered right to your inbox!

Thank you for your subscription

×