Created
April 15, 2015 20:40
-
-
Save jeffstagg/cc6b9ca896a6bd34923d to your computer and use it in GitHub Desktop.
LESS Mixins
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
<!DOCTYPE html> | |
<html> | |
<head><title>Mixins</title></head> | |
<body> | |
<h1 role="heading">Borders</h1> | |
<section> | |
<div class="rounded blue"> | |
<p>This element will have blue rounded borders</p> | |
</div> | |
<div class="rounded red"> | |
<p>This element will have red rounded borders</p> | |
</div> | |
<div class="rounded green"> | |
<p>This element will have green rounded borders</p> | |
</div> | |
</section> | |
</body> | |
</html> |
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
@red: #f00; | |
@green: #0f0; | |
@blue: #00f; | |
@radius-size: 10px; | |
.round-borders(@color) { | |
-webkit-border-radius: @radius-size; | |
-moz-border-radius: @radius-size; | |
border-radius: @radius-size; | |
border: 5px solid @color; | |
} |
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
@import "rounded-corners"; | |
.rounded { | |
&.red { | |
.round-borders(@red); | |
} | |
&.green { | |
.round-borders(@green); | |
} | |
&.blue { | |
.round-borders(@blue); | |
} | |
} | |
section>div { | |
display: inline-block; | |
width: 100px; | |
padding: 5px; | |
margin-left: 20px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment