Skip to content

Instantly share code, notes, and snippets.

@alehandrof
Last active December 13, 2015 19:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alehandrof/4966718 to your computer and use it in GitHub Desktop.
Save alehandrof/4966718 to your computer and use it in GitHub Desktop.
Good things about LESS
/* 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