Created
April 16, 2013 12:04
-
-
Save bpainter/5395417 to your computer and use it in GitHub Desktop.
A CodePen by Bermon Painter. Control Directives - if, else if, else
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
<h1>Control Directives - if, else if, else</h1> | |
<p>One of the features that makes Sass more robust that other preprocessors is the wide variety of control directives.</p> | |
<button type="submit">Submit to our will</button> | |
<button type="reset">Start Over</button> | |
<button class="cancel">Give Up</button> |
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
@import "compass"; | |
h1 { | |
font-size: 20px; | |
} | |
%button { | |
background-color: none; | |
border-width: 1px; | |
border-style: solid; | |
display: inline-block; | |
margin: 0 5px; | |
padding: 12px 24px; | |
} | |
@mixin button ($color, $type) { | |
@extend %button; | |
border-color: darken($color, 20%); | |
border-radius: 4px; | |
color: lighten($color, 60%); | |
@if $type == "flat" { | |
background-color: $color; | |
} @else if $type == "glossy" { | |
background-image: linear-gradient(lighten($color, 10%) 50%, darken($color, 10%) 50%); | |
} @else if $type == "gradient" { | |
background-image: linear-gradient(lighten($color, 10%), darken($color, 10%)); | |
} | |
} | |
button[type="submit"] { | |
@include button(green, gradient); | |
} | |
button[type="reset"] { | |
@include button(#999, flat); | |
} | |
button.cancel { | |
@include button(red, glossy); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment