The SDX library includes a responsive, mobile first 12 column grid system. It includes predefined classes for easy layout options and is based on Bootstrap’s Grid component. The grid is using a flexbox based system by default.
See real fullscreen example.
div class="container"> <!-- or "container-fluid" or "container-page", see below -->
<div class="row">
<div class="col-xs">col-xs</div>
<div class="col-xs">col-xs</div>
</div>
</div>
Introduction
Grid systems are used for creating page layouts through a series of rows and columns that house your content. Here’s how the Bootstrap grid system works:
- Rows must be placed within a .container (fixed width) or .container-fluid (full-width) or .container-page (full-width, max width 1440px) for proper alignment and padding. Use rows to create horizontal groups of columns.
- Content should be placed within columns, and only columns may be immediate children of rows.
- Predefined grid classes like .row and .col-xs-4 are available for quickly making grid layouts.
- Columns create gutters (gaps between column content) via padding. That padding is offset in rows for the first and last column via negative margin on .rows.
- The negative margin is why the examples below are outdented. It’s so that content within grid columns is lined up with non-grid content.
- Grid columns are created by specifying the number of 12 available columns you wish to span. For example, three equal columns would use three .col-xs-4.
- If more than 12 columns are placed within a single row, each group of extra columns will, as one unit, wrap onto a new line.
- Grid classes apply to devices with screen widths greater than or equal to the breakpoint sizes, and override grid classes targeted at smaller devices. Therefore, e.g. applying any .col-md-* class to an element will not only affect its styling on medium devices but also on large devices if a .col-lg-* class is not present.
Sample mobile-to-desktop layout
Using a set of .col-md-* grid classes, you can create a basic grid system that starts out stacked on mobile devices and tablet devices (the extra small to small range) before becoming horizontal on desktop (medium) devices. Place grid columns in any .row.
Equal-width
Utilize breakpoint-specific column classes for equal-width columns. Add any number of .col-{breakpoint}s for each breakpoint you need and every column will be the same width.
For example, here are two grid layouts that apply to every device and viewport, from xs to ul.
Setting one column width
Auto-layout for columns also means you can set the width of one column and the others will automatically resize around it. You may use predefined grid classes (as shown below) or inline widths. Note that the other columns will resize no matter the width of the center column.
Variable width content
Using the .col-{breakpoint}-auto classes, columns can size themselves based on the natural width of their content. This comes in handy with single line content like inputs, numbers, etc. This, in conjunction with "horizontal alignment" classes, can be used for centering layouts with uneven column sizes as viewport width changes.
Responsive classes
The SDX grid includes six tiers of predefined classes for building complex responsive layouts. Customize the size of your columns on extra small (xs), small (sm), medium (md), large (lg), extra large (xl) or ultra large (ul) devices however you see fit.
All breakpoints
For grids that are the same from the smallest of devices to the largest, use the .col-xs and .col-xs-* classes. Specify a numbered class when you need a particularly sized column; otherwise, feel free to stick to .col-xs.
The grid requires a class for full-width columns. If you have a .col-sm-6 and don’t add .col-xs-12, your xs grid will not render correctly.
Alignment
Use flexbox alignment utilities to vertically and horizontally align columns.
Vertical alignment
Align the whole row
Align individual items
Horizontal alignment
Gutters between rows
Gutters between rows can be activated using the .row--gutters modifier. This adds a responsive space between both rows and cols which is very useful for forms.
No gutters between cols
The gutters between columns in our predefined grid classes can be removed with .row--no-gutters. This removes the negative margins from .row and the horizontal padding from all immediate children columns.
Reordering
Flex order
Use flexbox utilities for controlling the visual order of your content.
Offsetting columns
Move columns to the right using offset-md-* classes. These classes increase the left margin of a column by * columns. For example, .offset-md-4 moves .col-md-4 over four columns.
Push and pull
Easily change the order of our built-in grid columns with .push-md-* and .pull-md-* modifier classes.
Grid without margin (mobile only)
Using .full-width-sm-down on any element will render them in full screen mode for mobile devices and tablet devices (the extra small and small range) only, whereas larger screens render normally.