Skip to content

Instantly share code, notes, and snippets.

@barryvdh
Last active March 7, 2023 23:38
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save barryvdh/2834636 to your computer and use it in GitHub Desktop.
Save barryvdh/2834636 to your computer and use it in GitHub Desktop.
custom grid
/* ===== 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);
@lindseybradford
Copy link

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