Skip to content

Instantly share code, notes, and snippets.

@jmblog
Created August 21, 2012 05:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmblog/3412221 to your computer and use it in GitHub Desktop.
Save jmblog/3412221 to your computer and use it in GitHub Desktop.
Sass mixin for CSS Heart Shape
// border-radius(), transform() and transform-origin() mixins are from Compass.
// http://compass-style.org/
@mixin heart($width: 50px, $color: hotpink) {
$half: ($width / 2);
$height: ($half * 1.6);
display: inline-block;
position: relative;
width: $width;
height: $height;
&::before,
&::after {
position: absolute;
content: "";
left: $half;
top: 0;
width: $half;
height: $height;
background: $color;
@include border-radius($half $half 0 0);
@include transform(rotate(-45deg));
@include transform-origin(0, 100%);
}
&::after {
left: 0;
@include transform(rotate(45deg));
@include transform-origin(100%, 100%);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment