I have a situation where the grid can't have an outside left and right padding.
How to set padding-left:0; for first column in line and set padding-right:0. This should also when screen changes... Or make similar result.
<div class="row line">
<div class="large-2 medium-3 small-4 columns"></div>
<div class="large-2 medium-3 small-4 columns"></div>
<div class="large-2 medium-3 small-4 columns"></div>
<div class="large-2 medium-3 small-4 columns"></div>
</div>
Yellow space should be with no padding, white spaces has default foundation padding.
Adjusting the Margin Size of an HTML Element With CSS You can remove this margin by setting the top and left margin to zero. Like the padding and border, the sizes of specific sides of the margin can be set using margin-left , margin-right , margin-top , and margin-bottom .
to fix this, you simply need to update the box-sizing parameter and set this to border-box in your css. Or you can do this for all elements by simply adding the following. This tells the browser to account for any border and padding in the values you specify for an element's width and height.
One way to achieve this would be to target the first and last columns.
.row.line > .columns:first-child {
padding-left: 0;
}
.row.line > .columns:last-child {
padding-right: 0;
}
Another option would be to create a class to apply to the first and last columns.
<div class="row line">
<div class="large-2 medium-3 small-2 columns column-first"></div>
<div class="large-2 medium-3 small-2 columns"></div>
<div class="large-2 medium-3 small-2 columns"></div>
<div class="large-2 medium-3 small-2 columns column-last"></div>
</div>
.column-first {
padding-left: 0;
}
.column-last {
padding-right: 0;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With