Grid-based forms
Sample form/content layout utilizing CSS Grid
Grid-based forms SCSS
/* Visionary Grid (https://visionary.com) */
@mixin gbfcol($cols) {
grid-column-end: span $cols;
}
.grid {
display: grid;
grid-template-columns: repeat(12, 1fr);
gap: $d-gutter;
width: 100%;
padding-top: 30px;
& > * {
align-self: start;
grid-column: auto / span 3;
}
.grid-col {
@for $i from 1 through 12 {
&-#{$i} {
@include gbfcol($i);
}
}
&-last + * {
grid-column-start: 1;
}
}
}
// Phone (landscape)
@media all and (min-width: 500px) {
.grid .grid-pl-col {
@for $i from 1 through 12 {
&-#{$i} {
@include gbfcol($i);
}
}
&-last + * {
grid-column-start: 1;
}
&-nolast + * {
grid-column-start: auto;
}
}
}
// Tablet (portrait)
@media all and (min-width: 768px) {
.grid .grid-tp-col {
@for $i from 1 through 12 {
&-#{$i} {
@include gbfcol($i);
}
}
&-last + * {
grid-column-start: 1;
}
&-nolast + * {
grid-column-start: auto;
}
}
}
// Tablet (landscape)
@media all and (min-width: 992px) {
.grid .grid-tl-col {
@for $i from 1 through 12 {
&-#{$i} {
@include gbfcol($i);
}
}
&-last + * {
grid-column-start: 1;
}
&-nolast + * {
grid-column-start: auto;
}
}
}
// Desktop
@media all and (min-width: 1200px) {
.grid .grid-d-col {
@for $i from 1 through 12 {
&-#{$i} {
@include gbfcol($i);
}
}
&-last + * {
grid-column-start: 1;
}
&-nolast + * {
grid-column-start: auto;
}
}
}
Grid-based forms CSS
/* Visionary Grid (https://visionary.com) */
.grid {
display: grid;
grid-template-columns: repeat(12, 1fr);
gap: 20px;
width: 100%;
padding-top: 30px;
}
.grid > * {
align-self: start;
grid-column: auto/span 3;
}
/* Default grid columns */
.grid .grid-col-1 {
grid-column-end: span 1;
}
.grid .grid-col-2 {
grid-column-end: span 2;
}
.grid .grid-col-3 {
grid-column-end: span 3;
}
.grid .grid-col-4 {
grid-column-end: span 4;
}
.grid .grid-col-5 {
grid-column-end: span 5;
}
.grid .grid-col-6 {
grid-column-end: span 6;
}
.grid .grid-col-7 {
grid-column-end: span 7;
}
.grid .grid-col-8 {
grid-column-end: span 8;
}
.grid .grid-col-9 {
grid-column-end: span 9;
}
.grid .grid-col-10 {
grid-column-end: span 10;
}
.grid .grid-col-11 {
grid-column-end: span 11;
}
.grid .grid-col-12 {
grid-column-end: span 12;
}
.grid .grid-col-last + * {
grid-column-start: 1;
}
/* Phone (landscape) >= 500px wide */
@media all and (min-width: 500px) {
.grid .grid-pl-col-1 {
grid-column-end: span 1;
}
.grid .grid-pl-col-2 {
grid-column-end: span 2;
}
.grid .grid-pl-col-3 {
grid-column-end: span 3;
}
.grid .grid-pl-col-4 {
grid-column-end: span 4;
}
.grid .grid-pl-col-5 {
grid-column-end: span 5;
}
.grid .grid-pl-col-6 {
grid-column-end: span 6;
}
.grid .grid-pl-col-7 {
grid-column-end: span 7;
}
.grid .grid-pl-col-8 {
grid-column-end: span 8;
}
.grid .grid-pl-col-9 {
grid-column-end: span 9;
}
.grid .grid-pl-col-10 {
grid-column-end: span 10;
}
.grid .grid-pl-col-11 {
grid-column-end: span 11;
}
.grid .grid-pl-col-12 {
grid-column-end: span 12;
}
.grid .grid-pl-col-last + * {
grid-column-start: 1;
}
.grid .grid-pl-col-nolast + * {
grid-column-start: auto;
}
}
/* Tablet (portrait) >= 768px wide */
@media all and (min-width: 768px) {
.grid .grid-tp-col-1 {
grid-column-end: span 1;
}
.grid .grid-tp-col-2 {
grid-column-end: span 2;
}
.grid .grid-tp-col-3 {
grid-column-end: span 3;
}
.grid .grid-tp-col-4 {
grid-column-end: span 4;
}
.grid .grid-tp-col-5 {
grid-column-end: span 5;
}
.grid .grid-tp-col-6 {
grid-column-end: span 6;
}
.grid .grid-tp-col-7 {
grid-column-end: span 7;
}
.grid .grid-tp-col-8 {
grid-column-end: span 8;
}
.grid .grid-tp-col-9 {
grid-column-end: span 9;
}
.grid .grid-tp-col-10 {
grid-column-end: span 10;
}
.grid .grid-tp-col-11 {
grid-column-end: span 11;
}
.grid .grid-tp-col-12 {
grid-column-end: span 12;
}
.grid .grid-tp-col-last + * {
grid-column-start: 1;
}
.grid .grid-tp-col-nolast + * {
grid-column-start: auto;
}
}
/* Tablet (landscape) >= 992px wide */
@media all and (min-width: 992px) {
.grid .grid-tl-col-1 {
grid-column-end: span 1;
}
.grid .grid-tl-col-2 {
grid-column-end: span 2;
}
.grid .grid-tl-col-3 {
grid-column-end: span 3;
}
.grid .grid-tl-col-4 {
grid-column-end: span 4;
}
.grid .grid-tl-col-5 {
grid-column-end: span 5;
}
.grid .grid-tl-col-6 {
grid-column-end: span 6;
}
.grid .grid-tl-col-7 {
grid-column-end: span 7;
}
.grid .grid-tl-col-8 {
grid-column-end: span 8;
}
.grid .grid-tl-col-9 {
grid-column-end: span 9;
}
.grid .grid-tl-col-10 {
grid-column-end: span 10;
}
.grid .grid-tl-col-11 {
grid-column-end: span 11;
}
.grid .grid-tl-col-12 {
grid-column-end: span 12;
}
.grid .grid-tl-col-last + * {
grid-column-start: 1;
}
.grid .grid-tl-col-nolast + * {
grid-column-start: auto;
}
}
/* Desktop >= 1200px wide */
@media all and (min-width: 1200px) {
.grid .grid-d-col-1 {
grid-column-end: span 1;
}
.grid .grid-d-col-2 {
grid-column-end: span 2;
}
.grid .grid-d-col-3 {
grid-column-end: span 3;
}
.grid .grid-d-col-4 {
grid-column-end: span 4;
}
.grid .grid-d-col-5 {
grid-column-end: span 5;
}
.grid .grid-d-col-6 {
grid-column-end: span 6;
}
.grid .grid-d-col-7 {
grid-column-end: span 7;
}
.grid .grid-d-col-8 {
grid-column-end: span 8;
}
.grid .grid-d-col-9 {
grid-column-end: span 9;
}
.grid .grid-d-col-10 {
grid-column-end: span 10;
}
.grid .grid-d-col-11 {
grid-column-end: span 11;
}
.grid .grid-d-col-12 {
grid-column-end: span 12;
}
.grid .grid-d-col-last + * {
grid-column-start: 1;
}
.grid .grid-d-col-nolast + * {
grid-column-start: auto;
}
}