Last active
December 13, 2015 19:59
-
-
Save alehandrof/4966718 to your computer and use it in GitHub Desktop.
Good things about LESS
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
/* Good things about LESS */ | |
// Variables (or constants, rather) | |
// & operations | |
@baseline: 21px; | |
@red: #a00; | |
.error { | |
margin-bottom: @baseline; | |
padding: (@baseline / 2); | |
color: @red; | |
background: lighten (@red, 50); | |
} | |
// Did I mention inline comments? (Not included in the processed CSS.) | |
// Nesting selectors | |
ul#sidebar { | |
padding: 0; | |
li { | |
display: inline-block; | |
} | |
} | |
// Nesting pseudo-classes | |
a { | |
text-decoration: none; | |
&:hover { | |
text-decoration: underline; | |
} | |
} | |
// Re-using code with mixins | |
.gradient (@color) { | |
/* put some really complicated code here | |
including browser-specific horribleness */ | |
} | |
.box { | |
.gradient (#ccc); | |
} | |
/* See http://lesselements.com/ for some common use cases | |
although I've preferred to roll my own, thus far. */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment