1. sds-grid()
A SCSS mixin to turn an element into a CSS Grid container with equally divided columns.
Structure
Much like the CSS Flexbox, CSS Grid is not applied directly to the elements you wish to position. Instead, Grid and most of its complementary CSS properties are declared on the "parent" of the elements to be affected. The following example illustrates this.
Implementation
This mixin is one of the most commonly used because it offers developers an easy and automatic way of implementing {n
} number of columns while also controlling the space between them.
This mixin accepts two parameters: $columns
and $gap
. The $columns
parameter is required, and should be a number that expresses the amount of columns desired in the grid (it's important to reference). The $gap
parameter is optional, and its default value is set to 0. This parameter accepts a number value that should be specified in measurable units such a pixels, percentages, rem, etc.
Basic implementation of sds-grid
:
Providing a value for the $gap
parameter will control the space between columns:
When specifying a value for the $gap
parameter, it is strongly recommended to use Sipster's sds-spc()
function for most instances. The following example illustrates this method.
which compiles to:
Last updated