Extra 25% off for all sale items + Free CoreUI Icons PRO with every order! Limited offer for the first 100 people, use code 2024BWCW25 during checkout.
Use our powerful mobile-first flexbox grid to build layouts of all shapes and sizes thanks to a twelve column system, six default responsive tiers, Sass variables and mixins, and dozens of predefined classes.
Loading...
## Example
CoreUI's grid system uses a series of containers, rows, and columns to layout and align content. It's built with
[flexbox](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout/Basic_Concepts_of_Flexbox) in new
window and is fully responsive. Below is an example and an in-depth explanation for how the grid
system comes together.
Loading...
Loading...
The above example creates three equal-width columns across all devices and viewports using our predefined grid
classes. Those columns are centered in the page with the parent `c-container`.
## How it works
Breaking it down, here's how the grid system comes together:
- **Our grid supports six responsive breakpoints**. Breakpoints are based on `min-width` media queries, meaning they
affect that breakpoint and all those above it (e.g., `[sm]="4"` applies to `sm`, `md`, `lg`, `xl`, and `xxl`). This
means you can
control container and column sizing and behavior by each breakpoint.
- **Containers center and horizontally pad your content**. Use `c-container` for a responsive pixel width,
`c-container fluid` for `width: 100%` across all viewports and devices, or a responsive container (e.g., `c-container
breakpoint="md"`) for
a combination of fluid and pixel widths.
- **Rows are wrappers for columns**. Each column has horizontal `padding` (called a **gutter**) for controlling the
space between them. This `padding` is then counteracted on the rows with negative margins to ensure the content in
your
columns is visually aligned down the left side. Rows also support modifier classes to [uniformly apply column
sizing](https://coreui.io/angular/docs/layout/grid/#row-columns)
and [gutter classes](https://coreui.io/angular/docs/layout/gutters) to change the spacing of your content.
- **Columns are incredibly flexible**. There are 12 template columns available per row, allowing you to create
different combinations of elements that span any number of columns. Column classes indicate the number of template
columns to span (e.g., `c-col [xs]="4"` spans four). Widths are set in percentages so you always have the same
relative sizing.
- **Gutters are also responsive and customizable**. [Gutter classes](https://coreui.io/angular/docs/layout/gutters)
are available across all breakpoints, with all the
same sizes as our [margin and padding spacing](https://coreui.io/docs/utilities/spacing/). Change horizontal gutters
with `.gx-*` classes, vertical gutters with `.gy-*`, or all gutters with `.g-*` classes. `.g-0` is also available to
remove gutters.
Be aware of the limitations and [bugs around flexbox](https://github.com/philipwalton/flexbugs), like the [inability
to use some HTML elements as flex containers](https://github.com/philipwalton/flexbugs#flexbug-9).
## Grid options
CoreUI grid system can adapt across all six default breakpoints, and any breakpoints you customize. The six default
grid tiers are as follow:
- Extra small (`xs`)
- Small (`sm`)
- Medium (`md`)
- Large (`lg`)
- Extra large (`xl`)
- Extra extra large (`xxl`)
As noted above, each of these breakpoints have their own container, unique class prefix, and modifiers. Here's how the
grid changes across these breakpoints:
## Auto-layout columns
Utilize breakpoint-specific column classes for easy column sizing without an explicit numbered class like `c-col
sm="6"`.
### Equal-width
For example, here are two grid layouts that apply to every device and viewport, from `xs` to `xxl`. Add any number of
unit-less classes for each breakpoint you need and every column will be the same width.
Loading...
Loading...
### Setting one column width
Auto-layout for flexbox grid columns also means you can set the width of one column and have the sibling columns
automatically resize around it. You may use predefined grid classes (as shown below), grid mixins, or inline widths.
Note that the other columns will resize no matter the width of the center column.
Loading...
Loading...
### Variable width content
Use `c-col xs|sm|md|lg|xl="auto"` props to size columns based on the natural width of their content.
Loading...
Loading...
## Responsive classes
CoreUI's grid includes six tiers of predefined classes for building complex responsive layouts. Customize the size of
your columns on extra small, small, medium, large, or extra large devices however you see fit.
### All breakpoints
For grids that are the same from the smallest of devices to the largest, use the `c-col` and `c-col xs=` classes.
Specify a numbered class when you need a particularly sized column; otherwise, feel free to stick to `c-col`.
Loading...
Loading...
### Stacked to horizontal
Using a single set of `c-col sm=` classes, you can create a basic grid system that starts out stacked and becomes horizontal at the small breakpoint (sm).
Loading...
Loading...
### Mix and match
Don't want your columns to simply stack in some grid tiers? Use a combination of different classes for each tier as
needed. See the example below for a better idea of how it all works.
Loading...
Loading...
### Row columns
Use the responsive `c-row [sm | md | lg | xl | xxl]=*` classes to quickly set the number of columns that best render your
content and layout. Whereas normal `c-col xs=` classes apply to the individual columns (e.g., `c-col xs="4"`), the row
columns classes are set on the parent `c-row` as a shortcut. With c-row `c-row [sm | md | lg | xl | xxl]="'auto'"` you can
give the columns their natural width.
Use these row columns classes to quickly create basic grid layouts or to control your card layouts.
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
## Nesting
To nest your content with the default grid, add a new `row` and set of `.col-sm-*` columns within an existing `.col-sm-*` column.
Nested rows should include a set of columns that add up to 12 or fewer (it is not required that you use all 12 available columns).
|prop|description|type|default|notes|
|:---|:---|:---|:---:|---|
|`fluid`|Set container 100% wide, spanning the entire width of the viewport.|`boolean`|_undefined_|
|`breakpoint`|Set container 100% wide until `{sm\|md\|lg\|xl\|xxl}` breakpoint.|`string`|_undefined_|
|prop|description|type|default|notes|
|:---|:---|:---|:---:|---|
|`xs`|The number of columns/offset/order on extra small devices (<576px).|`auto \| number`|_undefined_|
|`sm`|The number of columns/offset/order on extra small devices (<768px).|`auto \| number`|_undefined_|
|`md`|The number of columns/offset/order on extra small devices (<992px).|`auto \| number`|_undefined_|
|`lg`|The number of columns/offset/order on extra small devices (<1200px).|`auto \| number `|_undefined_|
|`xl`|The number of columns/offset/order on extra small devices (<1400px).|`auto \| number `|_undefined_|
|`xxl`|The number of columns/offset/order on extra small devices (≥1400px).|`auto \| number`|_undefined_|
---
### gutter
_directive_ for c-row
##### Inputs
|prop|description|type|default|notes|
|:---|:---|:---|:---:|---|
|`gutter`|Define padding between columns to space and align content responsively in the Bootstrap grid system.|(IGutterObject | GutterBreakpoints | Gutters)|_undefined_|
|prop|description|type|default|notes|
|:---|:---|:---|:---:|---|
|`xs`|The number of columns on extra small devices (<576px).|`auto \| number \| boolean`|_undefined_|
|`sm`|The number of columns on extra small devices (<768px).|`auto \| number \| boolean`|_undefined_|
|`md`|The number of columns on extra small devices (<992px).|`auto \| number \| boolean`|_undefined_|
|`lg`|The number of columns on extra small devices (<1200px).|`auto \| number \| boolean`|_undefined_|
|`xl`|The number of columns on extra small devices (<1400px).|`auto \| number \| boolean`|_undefined_|
|`xxl`|The number of columns on extra small devices (≥1400px).|`auto \| number \| boolean`|_undefined_|
|`offset`|Offset grid columns|`number\|{sm\|md\|lg\|xl\|xxl}:number`|_undefined_|
|`order`|Controls the visual order of your columns. Includes support for `1` through `5` across all six grid tiers.|`"first"\|"last"\|number\|{sm\|md\|lg\|xl\|xxl}:number`|_undefined_|