If you use sass scss, you can write it once and reuse it as a simple line of code, for example:
In your sass or scss file, define mixin as follows:
@mixin rounded($amount: "10px",$position: null) { @if $position != null { @if $position == "top" or $position == "bottom" { //top or bottom -webkit-border-
Then in the scss file you can use this mixin like this:
@include rounded(); @include rounded(15px); @include rounded(15px, top); @include rounded(15px, bottom); @include rounded(15px, top-right); @include rounded(15px, top-left); @include rounded(15px, bottom-right); @include rounded(15px, bottom-left);
This .scss code will generate this .css code:
-webkit-border-radius: "10px"; -moz-border-radius: "10px"; border-radius: "10px"; -webkit-border-radius: 15px; -moz-border-radius: 15px; border-radius: 15px; -webkit-border-top-left-radius: 15px; -moz-border-top-left-radius: 15px; border-top-left-radius: 15px; -webkit-border-top-right-radius: 15px; -moz-border-top-right-radius: 15px; border-top-right-radius: 15px; -webkit-border-bottom-left-radius: 15px; -moz-border-bottom-left-radius: 15px; border-bottom-left-radius: 15px; -webkit-border-bottom-right-radius: 15px; -moz-border-bottom-right-radius: 15px; border-bottom-right-radius: 15px; -webkit-border-top-right-radius: 15px; -moz-border-top-right-radius: 15px; border-top-right-radius: 15px; -webkit-border-top-left-radius: 15px; -moz-border-top-left-radius: 15px; border-top-left-radius: 15px; -webkit-border-bottom-right-radius: 15px; -moz-border-bottom-right-radius: 15px; border-bottom-right-radius: 15px; -webkit-border-bottom-left-radius: 15px; -moz-border-bottom-left-radius: 15px; border-bottom-left-radius: 15px; }
DevWL Dec 08 '13 at 6:42
source share