Last active
August 29, 2015 14:07
-
-
Save alterx/52844bfed34d92e68e6c to your computer and use it in GitHub Desktop.
Doing LESS with style
This file contains 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
@width: 100%; | |
@column-width: @width / 3; | |
@base-color: #cfcfcf; | |
.container { | |
width: @width; | |
.column { | |
width: @column-width; | |
} | |
p { | |
color: multiply(#ff6600, #000000) / 4; | |
background-color: @base-color + #111; | |
} | |
} |
This file contains 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
.border-radius(@radius: 5px) { | |
-webkit-border-radius: @radius; | |
-moz-border-radius: @radius; | |
border-radius: @radius; | |
} | |
.header-text { | |
color: #000; | |
font-family: verdana; | |
font-size: 20px; | |
&:hover { | |
color: green; | |
} | |
} | |
.sub-header-text() { | |
color: #ccc; | |
font-family: arial; | |
font-size: 16px; | |
&:hover { | |
color: red; | |
} | |
} | |
h1 { | |
.header-text(); | |
} | |
h2 { | |
.sub-header-text(); | |
} |
This file contains 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
#namespace { | |
.component { | |
background: #000; | |
} | |
} | |
.component { | |
background: #ccc; | |
} | |
.container { | |
.list-item { | |
.component; | |
} | |
.other-list-item { | |
#namespace .component; | |
} | |
} |
This file contains 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
/* | |
I'm a multiline | |
comment, as you can see | |
*/ | |
@var1: #ccc; //single line comment | |
@import "bootstrap"; // or bootstrap.less | |
@import "main.css"; // .css files too! |
This file contains 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
@color: #000; | |
#page { | |
#header { | |
color: @color; | |
} | |
@color: #fff; | |
} |
This file contains 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
// Variables | |
@color-green: #428bca; | |
@color-dark-green: darken(@color-green, 10%); | |
@selector-handle: handle; | |
@url-images: "../path/to/images"; | |
@property: color; | |
p { | |
@{property}: @color-green; | |
&:hover { | |
color: @color-dark-green; | |
} | |
} | |
.@{selector-handle} { | |
// rule set | |
} | |
span { | |
background: url("@{url-images}/image-name.png"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment