Created
March 17, 2016 03:53
-
-
Save watert/876a600c0eecc5a14f62 to your computer and use it in GitHub Desktop.
LESS grid system
This file contains hidden or 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
.desktop(@rules){ | |
@media (min-width: 769px) { @rules(); } | |
} | |
.pad(@rules) { | |
@media (max-width: 769px) { @rules(); } | |
} | |
.phone(@rules){ | |
@media (max-width: 420px) { @rules(); } | |
} | |
.clearfix(){ | |
&:after, &:before { content: ""; display: table; | |
// height: 0; visibility: hidden; | |
} | |
&:after {clear:both;} | |
& { zoom:1; } | |
} | |
.col-offset(@num, @columns:12){ margin-left:@num*100%/@columns; } | |
.col(@num, @columns:12) { | |
float: left; width:@num*100%/@columns; box-sizing: border-box; | |
position: relative; min-height: 1px; display: block;} | |
.col-push(@num, @columns:12) { | |
left: @num*100%/@columns; | |
} | |
.col-pull(@num, @columns:12) { | |
right: @num*100%/@columns; | |
} | |
.col-xs-offset(@num){ .phone({ .col-offset(@num); }) } | |
.col-xs-push(@num){ .phone({ .col-push(@num); }) } | |
.col-xs-pull(@num){ .phone({ .col-pull(@num); }) } | |
.col-xs(@num){ .phone({ .col(@num); }) } | |
.col-sm-offset(@num){ .pad({ .col-offset(@num); }) } | |
.col-sm-push(@num){ .pad({ .col-push(@num); }) } | |
.col-sm-pull(@num){ .pad({ .col-pull(@num); }) } | |
.col-sm(@num){ .pad({ .col(@num); }) } | |
.col-md-offset(@num){ .desktop({ .col-offset(@num); }) } | |
.col-md-push(@num){ .desktop({ .col-push(@num); }) } | |
.col-md-pull(@num){ .desktop({ .col-pull(@num); }) } | |
.col-md(@num){ .desktop({ .col(@num); }) } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment