12 columns Grid
12-grid is a set of specific classes for advanced grid layouts. It is intended to create a design using a 12 columns grid system.
NB: In this documentation, when you see this notation :
--o-property-{1-5}
, this means that all values from 1 to 5 exist. So when you see--o-property-{1-5}
, you can use :
--o-property-1
--o-property-2
--o-property-3
--o-property-4
--o-property-5
Behaviour
link BehaviourThe 12-grid utility classes set the following properties :
In Oxygen Builder, and in Bricks except for Bricks Sections and Bricks Containers, it also sets :
Both in Oxygen and Bricks, the classes need to “fight” with the builder defaults that sets display: flex
on sections (Oxy & Brx), containers (Brx) and div (Oxy). In these situations, the framework has higher selector specificity to achieve the expected result.
Helper Lines
link Helper LinesWhen creating a page layout, I like to have the 12 columns visible so I can easily know where my elemnts are placed on the grid.
So, I created a specific class in the OxyProps framework to help me with this. This is the class :
o-12-grid-helper-lines
This class is intended to be used temporarily, when you build your page, and then removed once you design is in place.
Usage
link UsageTo display your 12 columns grid on your builder canvas, follow these steps :
- Create you grid container. This can be a Section (Oxy / Brx), a Container (Brx), a Div (Oxy, Brx).
- Apply class
o-12-grid
to the container. ⚠️ Do not confuseo-12-grid
ando-grid-12
. - Create a div in your container. This will be a dummy element.
- Apply class
o-12-grid-helper-lines
to the div. Your 12 columns are now visible. - Et Voilà!
Advanced Spans
link Advanced SpansTwo sets of advanced columns spans and row spans will help you design on th 12 column grid.
Column Spans
link Column SpansThe grid-column CSS shorthand property specifies a grid item’s size and location within a grid column by contributing a line, a span, or nothing (automatic) to its grid placement, thereby specifying the inline-start and inline-end edge of its grid area. Source MDN
These classes will set the grid-column
CSS property in the form grid-column: X / span Y
.
- X is the start column
- Y is the number of columns the element will span.
So, for example, the class o-span-2-7
that sets grid-column: 2 / span 7
means : “Starts on column 2 and spreads over 7 columns”.
pattern:
o-span-{1-12}-{1-12}
Obviously, some combinations don’t exist, likeo-span-8-10
, as you can not havve an element that starts column 8 and spreads over 10 columns on a 12 columns grid.
12 columns span
link 12 columns spanOnly one class in this category, the element spanning 12 columns will be full width.
11 columns span
link 11 columns spanStarting either on column 1 or 2.
10 columns span
link 10 columns spanStarting either on columns 1, 2 or 3.
9 columns span
link 9 columns spanStarting either on columns 1, 2, 3 or 4.
8 columns span
link 8 columns spanStarting either on columns 1, 2, 3, 4 or 5.
7 columns span
link 7 columns spanStarting either on columns 1, 2, 3, 4, 5 or 6.
6 columns span
link 6 columns spanStarting either on columns 1, 2, 3, 4, 5, 6 or 7.
5 columns span
link 5 columns spanStarting either on columns 1, 2, 3, 4, 5, 6, 7 or 8.
4 columns span
link 4 columns spanStarting either on columns 1, 2, 3, 4, 5, 6, 7, 8 or 9.
3 columns span
link 3 columns spanStarting either on columns 1, 2, 3, 4, 5, 6, 7, 8, 9 or 10.
2 columns span
link 2 columns spanStarting either on columns 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 or 11.
1 column span
link 1 column spanStarting either on columns 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 or 12.
Row Spans
link Row SpansThe grid-row CSS shorthand property specifies a grid item’s size and location within the grid row by contributing a line, a span, or nothing (automatic) to its grid placement, thereby specifying the inline-start and inline-end edge of its grid area. Source MDN
These classes will set the grid-row
CSS property in the form grid-row: X / span Y
.
- X is the start row
- Y is the number of rows the element will span.
So, for example, the class o-rspan-2-7
that sets grid-row: 2 / span 7
means : “Starts on row 2 and spreads over 7 rows”.
pattern:
o-rspan-{1-12}-{1-12}
Obviously, some combinations don’t exist, likeo-rspan-8-10
, as you can not havve an element that starts column 8 and spreads over 10 rows on a 12 rows grid.
12 rows span
link 12 rows spanOnly one class in this category.
11 rows spans
link 11 rows spansStarting either on column 1 or 2.
10 rows spans
link 10 rows spansStarting either on rows 1, 2 or 3.
9 rows spans
link 9 rows spansStarting either on rows 1, 2, 3 or 4.
8 rows spans
link 8 rows spansStarting either on rows 1, 2, 3, 4 or 5.
7 rows spans
link 7 rows spansStarting either on rows 1, 2, 3, 4, 5 or 6.
6 rows spans
link 6 rows spansStarting either on rows 1, 2, 3, 4, 5, 6 or 7.
5 rows spans
link 5 rows spansStarting either on rows 1, 2, 3, 4, 5, 6, 7 or 8.
4 rows spans
link 4 rows spansStarting either on rows 1, 2, 3, 4, 5, 6, 7, 8 or 9.
3 rows spans
link 3 rows spansStarting either on rows 1, 2, 3, 4, 5, 6, 7, 8, 9 or 10.
2 rows spans
link 2 rows spansStarting either on rows 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 or 11.
1 row span
link 1 row spanStarting either on rows 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 or 12.
Responsive design with 12-grid
link Responsive design with 12-gridUnlike the OxyProps main grids system, where you can modify the number of columns of your grid system at various breakpoints, the 12-grid system is intended to keep 12 columns at all breakpoints.
Then, you achieve responsiveness by modifying the span classes at various breakpoints.
Imagine an example when, on desktop, we have a section with 2 divs of equal with. At the lg
breakpoint, we want the two divs to stack vetically.
This would be achieved with the following classes :
- Div1 :
o-span-1-6 o-lg-span-1-12
- Div2 :
o-span-7-6 o-lg-span-1-12
This is an extremely basic example, and would probaably be easier to achieve by controlling the pareent containeere with classes from thee maain grid system, but you can imagine complex behaviours we can achieve with this system.