Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spacing between grid cells in Zurb Foundation 4

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?

like image 855
at. Avatar asked Mar 05 '13 17:03

at.


2 Answers

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

like image 146
Emil Hemdal Avatar answered Nov 11 '22 06:11

Emil Hemdal


You can add offsets

<div class="row">
  <div class="large-1 columns">1</div>
  <div class="large-10 large-offset-1 columns">10, offset 1</div>
</div>

http://foundation.zurb.com/docs/components/grid.html

like image 35
paulusm Avatar answered Nov 11 '22 08:11

paulusm