Skip to content

Instantly share code, notes, and snippets.

@fredericmarx
Created May 25, 2014 22:47
Show Gist options
  • Save fredericmarx/eb99692e8236d2030d1d to your computer and use it in GitHub Desktop.
Save fredericmarx/eb99692e8236d2030d1d to your computer and use it in GitHub Desktop.
Circle Mixin – Having a little fun with Sass 3.3 Maps and Random
@mixin circle($radius: 100px, $bg: grey, $color: white) {
width: $radius;
height: $radius;
text-align: center;
line-height: $radius;
background-color: $bg;
color: $color;
overflow: hidden;
@include border-radius(50%);
.circle-content {
line-height: $line-height-base;
display: inline-block;
vertical-align: middle;
width: 100%;
padding: 10%;
font-size: $font-size-small;
h1,
h2,
h3,
h4,
h5,
p {
margin: 0;
}
}
}
$circle-sizes: (
xs: 50px,
sm: 100px,
md: 150px,
lg: 250px,
xl: 350px
);
@each $key, $value in $circle-sizes {
.circle-#{$key} {
@include circle($value);
.circle-content {
@include transform( rotate( random(30) - 10 + deg ) );
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment