A Pen by sebastianekstrom on CodePen.
Created
October 16, 2013 08:29
-
-
Save zetareticoli/7004484 to your computer and use it in GitHub Desktop.
A Pen by sebastianekstrom.
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
<a href="#" class="button button-confirm">Confirmation</a> | |
<a href="#" class="button button-warning">Warning</a> | |
<a href="#" class="button button-alert">Alert</a> |
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 "compass"; | |
@function set-button-text-color($color) { | |
@if (lightness( $color ) > 40) { | |
@return black; | |
} | |
@else { | |
@return white; | |
} | |
} | |
%button { | |
text-decoration: none; | |
padding: 2em 3em; | |
width: 30%; | |
margin: 2% auto; | |
display: block; | |
text-align: center; | |
font-size: 1.5em; | |
font-family: sans-serif; | |
font-weight: bold; | |
@include border-radius(10px); | |
} | |
.button { | |
@extend %button; | |
} | |
$button_confirm: green; | |
$button_warning: #ffc53a; | |
$button_alert: red; | |
.button-confirm { | |
background: $button_confirm; | |
color: set-button-text-color($button_confirm); | |
} | |
.button-warning { | |
background: $button_warning; | |
color: set-button-text-color($button_warning); | |
} | |
.button-alert { | |
background: $button_alert; | |
color: set-button-text-color($button_alert); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment