Last active
March 7, 2023 23:38
-
-
Save barryvdh/2834636 to your computer and use it in GitHub Desktop.
custom grid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ===== Primary Styles ===================================================== | |
Author: Fruitcake Studio (Barry vd. Heuvel) | |
========================================================================== */ | |
//Generate a custom (semantic) grid | |
.customGrid(@gridColumnWidth, @gridGutterWidth){ | |
#header, #main { | |
.row(); | |
} | |
.block { | |
.span(3); | |
} | |
#content{ | |
.span(9); | |
} | |
footer { | |
#copyright { | |
.span(12); | |
} | |
} | |
.thumbnails > li { | |
.span(3); | |
} | |
/* ===== Custom grid mixins ================================================= | |
Do not change this mixin below this line! | |
========================================================================== */ | |
.row() when( isnumber(@gridColumnWidth) ) { | |
margin-left: @gridGutterWidth * -1; | |
.clearfix(); | |
} | |
.row() when(@gridColumnWidth = auto){ | |
margin-left: 0; | |
} | |
.span(@columns: 1, @offset: 0) when( isnumber(@gridColumnWidth) ) { | |
float: left; | |
margin-left: (@gridColumnWidth * @offset) + (@gridGutterWidth * (@offset - 1)) + (@gridGutterWidth * 2); | |
width: (@gridColumnWidth * @columns) + (@gridGutterWidth * (@columns - 1)); | |
min-height: 1px; // prevent collapsing columns | |
} | |
.span (@columns, @offset: 0) when(@gridColumnWidth = auto){ | |
float: none; | |
display: block; | |
width: 100%; | |
margin-left: 0; | |
.box-sizing(border-box); | |
} | |
} | |
// Custom grid (default size) | |
.customGrid(@gridColumnWidth, @gridGutterWidth); |
Left out the two troublesome lines… sorry about that:
.customGrid(@gridColumnWidth768, @gridGutterWidth768);
and
.customGrid(@gridColumnWidth1200, @gridGutterWidth1200);
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for sharing this code!
I've imported in the order prescribed, and things work fine till I run into an issue in the custom-responsive.less …
These two lines throw an error, and return as undefined variables.
Is there a piece I'm missing where you define them elsewhere in your code? I can see the rest is working, as I'm able to get the media queries for this view:
@media (max-width: 767px) {
.customGrid(auto, 0);
}
Much appreciate your help!
LB