Included in:
Not included in any file!
Depends from:
BuilderMixins.build-lg-responsive-classes($selector + '-'+ $col)
BuilderMixins.build-md-responsive-classes($selector + '-'+ $col)
BuilderMixins.build-responsive-classes('grid-fill', null, $columns-sizes)
BuilderMixins.build-responsive-classes('grid-fit', null, $columns-sizes)
BuilderMixins.build-sm-responsive-classes($selector + '-'+ $col)
grid-item-place($col-end-prefix, column-end)
grid-item-place($col-start-prefix, column-start)
grid-item-place($row-end-prefix, row-end)
grid-item-place($row-start-prefix, row-start)
grid-span
grid-system
Local variables:
$grid-shortcut: 'grid'
$col-start-prefix: 'col-start'
$col-end-prefix: 'col-end'
$row-start-prefix: 'row-start'
$row-end-prefix: 'row-end'
$grid-cols: 12
--column-size-xs: 5rem
--column-size-sm: 6.25rem
--column-size-md: 9.375rem
--column-size-lg: 12.5rem
--column-size-xl: 15.625rem
--column-size-xxl: 21.875rem
--grid-auto-min-width: var(--column-size-xs)
$columns-sizes: (
"xs" : var(--column-size-xs),
"sm" : var(--column-size-sm),
"md" : var(--column-size-md),
"lg" : var(--column-size-lg),
"xl" : var(--column-size-xl),
"xxl": var(--column-size-xxl),
)
--grid-auto-min-width: #{ $value }
--grid-auto-min-width: #{ $value }
component
Grid system
Creates complex responsive web design grid layouts more easily and consistently across browsers
Breakpoints modifiers
Rosetta use CSS Grid for main layouts ( or smaller components if needed) and combined with Flexbox helpers you can create complex layouts.
To start working with Grid, just add the is-grid class to the grid container.
Basic usage:
grid-code-0
Copy
<div class="is-grid gap-xs">
<div class="box is-text-lg has-text-center color-white bg-violet">1</div>
<div class="box is-text-lg has-text-center color-white bg-violet">2</div>
<div class="box is-text-lg has-text-center color-white bg-violet">3</div>
<div class="box is-text-lg has-text-center color-white bg-violet">4</div>
</div>
Fixed columns
Rosetta, like others CSS Frameworks on the web, follow the 12-column grid standard. The main columns prefix is grid-cols and, combined with the desired number of columns, will change the default grid behavior which is one column.
Four columns grid grid-cols-4:
grid-code-1
Copy
<div class="is-grid grid-cols-4 gap-xs">
<div class="box is-text-lg has-text-center color-white bg-violet">1</div>
<div class="box is-text-lg has-text-center color-white bg-violet">2</div>
<div class="box is-text-lg has-text-center color-white bg-violet">3</div>
<div class="box is-text-lg has-text-center color-white bg-violet">4</div>
</div>
With lg:grid-cols-4 modifier:
Resize your browser to see when the columns are stacked and when they are horizontally distributed.
grid-code-2
Copy
<div class="is-grid lg:grid-cols-4 gap-xs">
<div class="box is-text-lg has-text-center color-white bg-violet">1</div>
<div class="box is-text-lg has-text-center color-white bg-violet">2</div>
<div class="box is-text-lg has-text-center color-white bg-violet">3</div>
<div class="box is-text-lg has-text-center color-white bg-violet">4</div>
</div>
Auto columns
There will be times when we want to use an automatic column layout. Rosetta provides six default column sizes modifiers for this purpose with the two auto column template variants auto-fit and auto-fill.
Class
rem
px
grid-fit-xs / grid-fill-xs
5rem
80px
grid-fit-sm / grid-fill-sm
6.25rem
100px
grid-fit-md / grid-fill-md
9.375rem
150px
grid-fit-lg / grid-fill-lg
12.5rem
200px
grid-fit-xl / grid-fill-xl
15.625rem
250px
grid-fit-xxl / grid-fill-xxl
21.875rem
350px
With grid-fit-sm modifier:
grid-code-3
Copy
<div class="is-grid grid-fit-sm gap-xs">
<div class="box is-text-lg has-text-center color-white bg-violet">1</div>
<div class="box is-text-lg has-text-center color-white bg-violet">2</div>
<div class="box is-text-lg has-text-center color-white bg-violet">3</div>
<div class="box is-text-lg has-text-center color-white bg-violet">4</div>
</div>
With grid-fill-sm modifier:
grid-code-4
Copy
<div class="is-grid grid-fill-sm gap-xs">
<div class="box is-text-lg has-text-center color-white bg-violet">1</div>
<div class="box is-text-lg has-text-center color-white bg-violet">2</div>
<div class="box is-text-lg has-text-center color-white bg-violet">3</div>
<div class="box is-text-lg has-text-center color-white bg-violet">4</div>
</div>
These modifiers act by changing the --grid-auto-min-width css variable according to the desired column size respectively, so you can target each class and change the default size:
Changing grid-fit-sm modifier size. To only target the following example we will combine the modifier with an example class: .example.grid-fit-sm
Modifying the variable:
--grid-auto-min-width: 20rem;
grid-code-6
Copy
<div class="example is-grid grid-fit-sm gap-xs">
<div class="box is-text-lg has-text-center color-white bg-violet">1</div>
<div class="box is-text-lg has-text-center color-white bg-violet">2</div>
<div class="box is-text-lg has-text-center color-white bg-violet">3</div>
<div class="box is-text-lg has-text-center color-white bg-violet">4</div>
<style>
.example.grid-fit-sm {
--grid-auto-min-width: 20rem;
}
</style>
</div>
Grid items sizes & placement
Rosetta also includes the CSS Grid grid-column and grid-row helpers properties. By indicating which column/row you want to start and/or end you can position items in the grid easily:
grid-code-7
Copy
<div class="is-grid grid-cols-5 gap-xs">
<div class="box color-white bg-violet is-text-lg has-text-center col-start-1 col-end-6">Header</div>
<div class="box color-white bg-violet is-text-lg has-text-center col-start-1 col-end-4">Body</div>
<div class="box color-white bg-violet is-text-lg has-text-center col-start-4 col-end-6">Sidebar</div>
<div class="box color-white bg-violet is-text-lg has-text-center col-start-1 col-end-6">Footer</div>
<style>
.cols-5 {
grid-template-rows: 1fr 3fr 1fr;
}
</style>
</div>
Header
Body
Sidebar
Footer
If you only need to expand a grid item you can use the col-span helper. Lets expand the first box to span 3 columns by applying the col-span-3 helper to it:
grid-code-8
Copy
<div class="example is-grid grid-fit-sm gap-xs">
<div class="box is-text-lg has-text-center color-white bg-violet col-span-3">1</div>
<div class="box is-text-lg has-text-center color-white bg-violet">2</div>
<div class="box is-text-lg has-text-center color-white bg-violet">3</div>
<div class="box is-text-lg has-text-center color-white bg-violet">4</div>
</div>
Applying the col-start and col-end helpers from desktop screen:
Resize your browser to see when the columns are stacked and when they are horizontally distributed.
grid-code-9
Copy
<div class="is-grid lg:grid-cols-5 gap-xs">
<div class="box is-text-lg color-white bg-violet has-text-center lg:col-start-1 lg:col-end-6">Header</div>
<div class="box is-text-lg color-white bg-violet has-text-center lg:col-start-1 lg:col-end-4">Body</div>
<div class="box is-text-lg color-white bg-violet has-text-center lg:col-start-4 lg:col-end-6">Sidebar</div>
<div class="box is-text-lg color-white bg-violet has-text-center lg:col-start-1 lg:col-end-6">Footer</div>
<style>
.lg:\cols-6 {
grid-template-rows: 1fr 3fr 1fr;
}
</style>
</div>
Header
Body
Sidebar
Footer
Applying the col-span helper from desktop screen:
Resize your browser to see when the columns are stacked and when they are horizontally distributed.
grid-code-10
Copy
<div class="example is-grid lg:grid-cols-3 gap-xs">
<div class="box is-text-lg has-text-center color-white bg-violet lg:col-span-3">1</div>
<div class="box is-text-lg has-text-center color-white bg-violet">2</div>
<div class="box is-text-lg has-text-center color-white bg-violet">3</div>
<div class="box is-text-lg has-text-center color-white bg-violet">4</div>
</div>
Variables
:root {
--column-size-xs : 5rem; // 80px
--column-size-sm : 6.25rem; // 100px
--column-size-md : 9.375rem; // 150px
--column-size-lg : 12.5rem; // 200px
--column-size-xl : 15.625rem; // 250px
--column-size-xxl : 21.875rem; // 350px
--grid-auto-min-width: var(--column-size-xs);
}