Skip to content

Instantly share code, notes, and snippets.

@mjj2000
Last active December 21, 2015 16:59
Show Gist options
  • Save mjj2000/6337698 to your computer and use it in GitHub Desktop.
Save mjj2000/6337698 to your computer and use it in GitHub Desktop.
Round avatar with CSS3
/* Configure by modifying variables:
$round-width: size of round avatar
$avatar-image: image path of ravatar
*/
div.round-avatar{
$round-border-size: 5px;
$round-border-color: #fff;
$round-width: 100px;
$round-height: $round-width;
$avatar-image: url('//goo.gl/Nw9pE2');
margin: 0 auto;
width: $round-width;
height: $round-height;
position: relative;
border-radius: 50%;
background: $round-border-color;
&:before {
content: '';
border-radius: 50%;
position: absolute;
width: $round-width - ($round-border-size * 2);
height: $round-height - ($round-border-size * 2);
top: $round-border-size;
left: $round-border-size;
background: $avatar-image no-repeat center;
background-size: 100%;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment