An open API service indexing awesome lists of open source software.

https://github.com/crgeary/css-custom-properties-grid

A very simple, configurable, responsive grid with CSS custom properties & flexbox.
https://github.com/crgeary/css-custom-properties-grid

css css-grid custom-properties

Last synced: 2 months ago
JSON representation

A very simple, configurable, responsive grid with CSS custom properties & flexbox.

Awesome Lists containing this project

README

        

# Custom Properties Grid

A very simple, configurable, responsive grid with CSS custom properties & flexbox.

* * *

## Features

* Per row gutter sizes (default 20px)
* Per row column counts (default 12 columns)
* Column offsets (default no offset)
* Column spans (default span 1 column)

## CSS

The entire code needed for a working grid is below:

```css
@media screen and (min-width: 767px) {
.row {
--columns: 12;
--gutter: 20px;
display: flex;
flex-wrap: wrap;
margin: 0 calc(var(--gutter) * -.5);
}
.row > .column {
--span: 1;
--offset: 0;
box-sizing: border-box;
padding: 0 calc(var(--gutter) * .5);
width: calc(100% / var(--columns) * var(--span));
margin-left: calc(100% / var(--columns) * var(--offset));
}
}
```

## Usage

* Set row gutter to 10px: `

`
* Set row column count to 5: `
`
* Offset column by 2 column widths: `
`
* Span a column by 6 column widths: `
`

## Support

Modern browsers (excluding Edge) - [http://caniuse.com/#feat=css-variables](http://caniuse.com/#feat=css-variables)

## Examples

A full list of examples can be found on the [demo page](https://css-custom-properties-grid.netlify.com/demo.html)

```html








```

```html








```

```html







```

A full list of examples can be found on the [demo page](https://css-custom-properties-grid.netlify.com/demo.html)