Skip to content

Instantly share code, notes, and snippets.

@haggen
Created January 11, 2013 00:34
Show Gist options
  • Save haggen/4507010 to your computer and use it in GitHub Desktop.
Save haggen/4507010 to your computer and use it in GitHub Desktop.
Force border-radius in Bootstrap to given value, but only when the original value is greater than zero.
// Border Radius
@mixin border-radius($value) {
@if type-of($value) == "list" {
$new-value: ();
@each $n in $value {
$new-value: append($new-value, if($n > 0, 2px, 0));
}
$value: $new-value;
} @else {
$value: if($value > 0, 2px, 0);
}
-webkit-border-radius: $value;
-moz-border-radius: $value;
border-radius: $value;
}
// Single Corner Border Radius
@mixin border-top-left-radius($value) {
@include border-radius($value 0 0 0);
}
@mixin border-top-right-radius($value) {
@include border-radius(0 $value 0 0);
}
@mixin border-bottom-right-radius($value) {
@include border-radius(0 0 $value 0);
}
@mixin border-bottom-left-radius($value) {
@include border-radius(0 0 0 $value);
}
// Single Side Border Radius
@mixin border-top-radius($value) {
@include border-radius($value $value 0 0);
}
@mixin border-right-radius($value) {
@include border-radius(0 $value $value 0);
}
@mixin border-bottom-radius($value) {
@include border-radius(0 0 $value $value);
}
@mixin border-left-radius($value) {
@include border-radius($value 0 0 $value);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment