Spacing between grid cells in Zurb Foundation 4
Solution 1
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.
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;
}
Solution 2
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
at.
Updated on July 26, 2022Comments
-
at. almost 2 years
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?
-
at. about 11 yearsMakes sense, my only concern if this is going to affect other parts of foundation in some way?
-
Emil Hemdal about 11 yearsIt will not affect Foundation itself but it might change some other layouts that you don't want to change. Check out my edited post.
-
Steven almost 8 yearsThe question was for modifying the existing gutter to a diff value, not introducing extra cols.