> For the complete documentation index, see [llms.txt](https://2600hz.gitbook.io/sds/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://2600hz.gitbook.io/sds/sds-3.0/sds-core/layout-system/css-grid/sds-grid.md).

# 1. sds-grid()

### 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.

```markup
<div class="parent">
  <div class="column"></div>
  <div class="column"></div>
  <div class="column"></div>
  <div class="column"></div>
</div>
```

```scss
// Correct grid application

.parent {
  display: grid;
}


// Incorrect

.parent {
  .column{
    display: grid;
  }
}
```

### 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.&#x20;

```css
@include sds-grid($columns, $gap);
```

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` :

<pre class="language-scss"><code class="lang-scss">.parent {
<strong>  @include sds-grid(4);
</strong>  
  .column {
    border: 1px solid sds-color(red, 80);
  }
}
</code></pre>

![](/files/-MdcDPyG5ETzK5ioBaQx)

Providing a value for the `$gap` parameter will control the space between columns:

<pre class="language-scss"><code class="lang-scss">.parent {
<strong>  @include sds-grid(4, 8px);
</strong>  
  .column {
    border: 1px solid sds-color(red, 80);
  }
}
</code></pre>

![](/files/-MdcDh_r_zlywmT9aNGA)

{% hint style="warning" %}
When specifying a value for the `$gap` parameter, it is strongly recommended to use [Sipster's `sds-spc()` function](/sds/sds-3.0/sds-core/layout-system/spacing.md#development-scss-spacing-function) for most instances. The following example illustrates this method.
{% endhint %}

```scss
.parent {
  @include sds-grid(4, sds-spc(8));
}
```

which compiles to:

```css
.parent {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-gap: 0.5rem;
}
```
