View on GitHub

cssgrid

Responsive CSS helper classes based on CSS Grid Layout

Home Demonstration

cssgrid examples

Grid Layouts using the new CSS Grid Feature.

Default 12 columns

Five break points

Each break point (xs, sm, md, lg, xl) starts at a minimum viewport size and automatically applies to the larger devices unless overridden.

.cg-col-4
.cg-col-4
.cg-col-4
.cg-col-sm-4
.cg-col-sm-4
.cg-col-sm-4
.cg-col-md-4
.cg-col-md-4
.cg-col-md-4
.cg-col-lg-4
.cg-col-lg-4
.cg-col-lg-4
.cg-col-xl-4
.cg-col-xl-4
.cg-col-xl-4

Three equal columns

Get three equal-width columns on desktops and scaling to large desktops. On mobile devices, tablets and below, the columns will automatically stack.

.cg-col-md-4
.cg-col-md-4
.cg-col-md-4

Three unequal columns

Get three columns starting at desktops and scaling to large desktops of various widths.

.cg-col-md-3
.cg-col-md-6
.cg-col-md-3

Two columns

Get two columns starting at desktops and scaling to large desktops.

.cg-col-md-8
.cg-col-md-4

Two columns with two nested columns

.cg-col-md-8
.cg-col-md-6
.cg-col-md-6
.cg-col-md-4

Mixed: mobile and desktop

.cg-col-12 .cg-col-md-8
.cg-col-6 .cg-col-md-4
.cg-col-6 .cg-col-md-4
.cg-col-6 .cg-col-md-4
.cg-col-6 .cg-col-md-4
.cg-col-6
.cg-col-6

Mixed: mobile, tablet, and desktop

.cg-col-12 .cg-col-sm-6 .cg-col-lg-8
.cg-col-6 .cg-col-lg-4
.cg-col-6 .cg-col-sm-4
.cg-col-6 .cg-col-sm-4
.cg-col-6 .cg-col-sm-4

Predefined Column Layouts

Two Columns .cg-cols-2

Default (50/50)

50%
50%

.cg-split-10-90

10%
90%

.cg-split-20-80

20%
80%

.cg-split-30-70

30%
70%

.cg-split-40-60

40%
60%

.cg-split-50-50

50%
50%

.cg-split-60-40

60%
40%

.cg-split-70-30

70%
30%

.cg-split-80-20

80%
20%

.cg-split-90-10

90%
10%

Responsive Two Columns .cg-cols-2

The predefined layouts are Desktop First. So the breakpoints go from LG to XS (instead of mobile first).

.cg-bk-lg

70%
30%

.cg-bk-md

70%
30%

.cg-bk-sm

70%
30%

.cg-bk-xs

70%
30%

Three Columns .cg-cols-3

Default (33/33/33)

33%
33%
33%

.cg-split-10-80-10

10%
80%
10%

.cg-split-15-70-15

15%
70%
15%

.cg-split-20-60-20

20%
60%
20%

.cg-split-25-50-25

25%
50%
25%

.cg-split-25-25-50

25%
25%
50%

.cg-split-50-25-25

50%
25%
25%

Responsive Three Columns .cg-cols-3

The predefined layouts are Desktop First. So the breakpoints go from LG to XS (instead of mobile first).

.cg-bk-lg

25%
50%
25%

.cg-bk-md

25%
50%
25%

.cg-bk-sm

25%
50%
25%

.cg-bk-xs

25%
50%
25%

Predefined Application Layouts - .cg-app

Application Layouts consist of Header, Main Areas and Footer.

One Column Application - .cg-cols-1 .cg-app

.cg-header
.cg-main

Two Column Application - .cg-cols-2 .cg-app (Default 50/50)

.cg-header
.cg-main-1
.cg-main-2

Two Column Application- .cg-cols-2 .cg-app .cg-split-30-70

Any predefined 2 column layout can be used.

.cg-header
.cg-main-1
.cg-main-2

Responsive Two Column Application - .cg-cols-2 .cg-app

.cg-bk-lg

.cg-header
.cg-main-1
.cg-main-2

.cg-bk-md

.cg-header
.cg-main-1
.cg-main-2

.cg-bk-sm

.cg-header
.cg-main-1
.cg-main-2

.cg-bk-xs

.cg-header
.cg-main-1
.cg-main-2

Three Column Application - .cg-cols-3 .cg-app (default 33/33/33)

.cg-header
.cg-main-1
.cg-main-2
.cg-main-3

Three Column Application - .cg-cols-3 .cg-app .cg-split-25-50-25

Any predefined 3 column layout can be used.

.cg-header
.cg-main-1
.cg-main-2
.cg-main-3

Responsive Three Column Application - .cg-cols-3 .cg-app

.cg-bk-lg

.cg-header
.cg-main-1
.cg-main-2
.cg-main-3

.cg-bk-md

.cg-header
.cg-main-1
.cg-main-2
.cg-main-3

.cg-bk-sm

.cg-header
.cg-main-1
.cg-main-2
.cg-main-3

.cg-bk-xs

.cg-header
.cg-main-1
.cg-main-2
.cg-main-3

Border Layout

Border - .cg-cols-3 .cg-border (default 33/33/33)

.cg-north
.cg-west
.cg-center
.cg-east
.cg-south

Border - .cg-cols-3 .cg-border .cg-split-25-50-25

Any predefined 3 column layout can be used.

.cg-north
.cg-west
.cg-center
.cg-east
.cg-south

Responsive Border - .cg-cols-3 .cg-border

.cg-bk-lg

.cg-north
.cg-west
.cg-center
.cg-east
.cg-south

.cg-bk-md

.cg-north
.cg-west
.cg-center
.cg-east
.cg-south

.cg-bk-sm

.cg-north
.cg-west
.cg-center
.cg-east
.cg-south

.cg-bk-xs

.cg-north
.cg-west
.cg-center
.cg-east
.cg-south