Created
March 27, 2011 18:48
-
-
Save victorbstan/889463 to your computer and use it in GitHub Desktop.
SASS cross browser rounded corner 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
$default_rounded_amount: 5px | |
// Round corner at position by amount. | |
@mixin round-corner($position, $amount: $default_rounded_amount) | |
border-#{$position}-radius: $amount | |
-webkit-border-#{$position}-radius: $amount | |
@mixin round-corner-mozilla($position, $amount: $default_rounded_amount) | |
-moz-border-radius-#{$position}: $amount | |
// Round left corners by amount | |
@mixin round-left-corners($amount: $default_rounded_amount) | |
@include round-corner("top-left", $amount) | |
@include round-corner("bottom-left", $amount) | |
@include round-corner-mozilla("topleft", $amount) | |
@include round-corner-mozilla("bottomleft", $amount) | |
// Round right corners by amount | |
@mixin round-right-corners($amount: $default_rounded_amount) | |
@include round-corner("top-right", $amount) | |
@include round-corner("bottom-right", $amount) | |
@include round-corner-mozilla("topright", $amount) | |
@include round-corner-mozilla("bottomright", $amount) | |
// Round top corners by amount | |
@mixin round-top-corners($amount: 5px) | |
@include round-corner("top-left", $amount) | |
@include round-corner("top-right", $amount) | |
@include round-corner-mozilla("topleft", $amount) | |
@include round-corner-mozilla("topright", $amount) | |
// Round bottom corners by amount | |
@mixin round-bottom-corners($amount: $default_rounded_amount) | |
@include round-corner("bottom-left", $amount) | |
@include round-corner("bottom-right", $amount) | |
@include round-corner-mozilla("bottomleft", $amount) | |
@include round-corner-mozilla("bottomright", $amount) | |
// Round all corners by amount | |
@mixin round-corners($amount: $default_rounded_amount) | |
border-radius: $amount | |
-moz-border-radius: $amount | |
-webkit-border-radius: $amount |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great guide! I just found this that may help the box-shadow
http://stackoverflow.com/questions/3525007/making-a-sass-mixin-with-optional-arguments