Search documentation v0.6.1

Layout

CSS utility classes for creating layouts

Source ↗️ Report Issue ↗️

Webcore comes with a handful of CSS utility classes to help you build different layouts faster. To use utility classes, you must have the includeUtilities rule set to true in your setup mixin. This is enabled by default. If you’d like to exclude utility classes from your CSS bundle, make sure to set this rule to false.

You must have utilities enabled in your setup to use them
@import 'webcoreui/styles';
@include setup((
...,
includeUtilities: true
));

Utilities comes with the following three base classes:

.flex and .grid CSS utility classes are a work in progress, and more utility classes, including responsive classes are to be added in future releases.
.container with a max-width, padding, and auto margins

Flex

When setting the .flex class on an element, you’ll be able to use the following utility classes to change its appearance:

Gaps
.flex.xxs
.flex.xs
.flex.sm

To set gaps, use onse of the spacing properties. The default values can be changed using the webcore.config.scss file.

ClassDefault value
.none 0
.xxs 2px
.xs 5px
.sm 10px
.md 15px
.default 20px
.lg 25px
.xl 30px
.xl2 35px
.xl3 40px
.xl4 45px
.xl5 50px
Note
Due to class naming requirements, 2xl, 3xl, 4xl, and 5xl spacing values can be used with the .xl2, .xl3, .xl4, and .xl5 classes.

Direction

To change the direction of your flex items, you can use the .row, .column, .row-reverse, and .column-reverse classes:

.row
1
2
3
4
.column
1
2
3
4
.row-reverse
1
2
3
4
.column-reverse
1
2
3
4
ClassCSS
.row flex-direction: row
.column flex-direction: column
.row-reverse flex-direction: row-reverse
.column-reverse flex-direction: column-reverse

Alignments

To change the vertical and horizontal alignments of flex items, you can use the following CSS classes:

.justify-start
1
2
3
.justify-end
1
2
3
.justify-center
1
2
3
.justify-between
1
2
3
.justify-around
1
2
3
.justify-evenly
1
2
3
Class for horizontal alignmentCSS
.justify-start justify-content: flex-start
.justify-center justify-content: center
.justify-end justify-content: flex-end
.justify-between justify-content: space-between
.justify-around justify-content: space-around
.justify-evenly justify-content: space-evenly
Class for vertical alignmentCSS
.items-start align-items: flex-start
.items-center align-items: center
.items-end align-items: flex-end
Use the .center class to set both justify-content and align-items to center.

Wraps

To change the way flex items wrap, use the .wrap, .nowrap, or .wrap-reverse classes:

.wrap
1
2
3
4
5
.nowrap
1
2
3
4
5
.wrap-reverse
1
2
3
4
5
ClassCSS
.wrap flex-wrap: wrap
.nowrap flex-wrap: nowrap
.wrap-reverse flex-wrap: wrap-reverse

Grid

Setting gaps and alignments for grids can be done using the same classes as shown above for .flex elements. To change the number of grid columns on your page, you can use the following CSS classes:

col-2
col-2
sm-3
sm-3
sm-3
sm-4
sm-4
sm-4
sm-4
ClassLayout
.col-2 Two-column layout
.col-3 Three-column layout
min-width: 600px: -
.xs-2 Two-column layout
.xs-3 Three-column layout
.xs-4 Four-column layout
min-width: 800px: -
.sm-2 Two-columns
.sm-3 Three-columns
.sm-4 Four-columns
min-width: 1024px: -
.md-2 Two-columns
.md-3 Three-columns
.md-4 Four-columns
.md-5 Five-columns
.md-6 Six-columns
min-width: 1200px: -
.lg-2 Two-columns
.lg-3 Three-columns
.lg-4 Four-columns
.lg-5 Five-columns
.lg-6 Six-columns
.lg-7 Seven-columns
.lg-8 Eight-columns

Request improvement for this page