Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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