Created
February 12, 2013 13:31
-
-
Save kogakure/4769904 to your computer and use it in GitHub Desktop.
SASS: Circle Mixin
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
@mixin circle($width, $color) { | |
width: $width; | |
height: $width; | |
background: $color; | |
-webkit-border-radius: $width/2; | |
-moz-border-radius: $width/2; | |
border-radius: $width/2; | |
} | |
.circle { | |
@include circle(200px, #999); | |
} |
nice job, as a bracket-less fanatic let me add the sass version and also some modification to fit with any kind of display type object ;)
=circle($size, $color, $display)
display: $display
line-height: $size
width: $size
height: $size
background: $color
-webkit-border-radius: $size/2
-moz-border-radius: $size/2
border-radius: $size/2
Implementation e.g.:
+circle(50px, $color, inline-block)
border-radius: 50%;
has the same effect
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks