Skip to content

Instantly share code, notes, and snippets.

@MagicJoseph
Last active August 29, 2015 14:07
Show Gist options
  • Save MagicJoseph/9ccc081f0949ff3406d4 to your computer and use it in GitHub Desktop.
Save MagicJoseph/9ccc081f0949ff3406d4 to your computer and use it in GitHub Desktop.
Sass circle generator - Compass library is required
@import "compass";
$circle-width: 25px !default; // cicrle width
$circle-height: $circle-width !default; // circle height must be same as width
$circle-bg: #fff !default; // background color is white
$circle-radius: 50% !default; // create circle with border-radius property
$circle-line-height: $circle-width; // circle line-height must be same as wdith
$circle-text-align: center !default; // text will be center
@mixin circle($cw:$circle-width, $ch:$cw, $cb:$circle-bg, $clh:$cw, $cta:$circle-text-align, $cr:$circle-radius) {
width: $cw;
height: $ch;
background: $cb;
line-height: $clh;
text-align: $cta;
@include inline-block;
@include border-radius($cr);
}
.circle {
@include circle;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<link rel="stylesheet" href="output-style.css">
</head>
<body>
<div class="circle"></div>
</body>
</html>
.circle {
width: 25px;
height: 25px;
background: #fff;
line-height: 25px;
text-align: center;
display: inline-block;
vertical-align: middle;
*vertical-align: auto;
*zoom: 1;
*display: inline;
-moz-border-radius: 50%;
-webkit-border-radius: 50%;
border-radius: 50%;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment