Skip to content

Instantly share code, notes, and snippets.

@etrepum
Created February 11, 2014 22:31
Show Gist options
  • Save etrepum/8945620 to your computer and use it in GitHub Desktop.
Save etrepum/8945620 to your computer and use it in GitHub Desktop.
Mission Bit Intro 03 - Avatar
/*
Resources:
Learn more about colors here:
- https://developer.mozilla.org/en-US/docs/Web/CSS/color_value
Having trouble with overriding rules? Learn about CSS specificity:
- http://specificity.keegan.st/
- https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity
For more challenge, try using gradients!
- https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Using_CSS_gradients
Want to change more about how it looks? See the full list of
SVG Presentation Attributes:
- https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute#Presentation_attributes
*/
.avatar {
/* this sets default styles for everything in the avatar group */
stroke-width: 5;
fill: white;
stroke: black;
}
.body {
/* Your code here!
* Examples of how to set colors:
fill: red;
fill: rgb(243, 191, 189);
fill: rgba(243, 191, 189, 0.5);
fill: hsl(180, 70%, 50%);
* You can even change the color and style of the line! Examples:
stroke: #FFF000;
stroke-width: 1;
*/
fill: #FFFFFF;
}
.eye {
}
.arm {
}
.shoe {
}
.left {
}
.right {
}
#head {
}
#right-eye {
}
#left-eye {
}
#neck {
}
#shirt {
}
#cape {
}
#mouth {
}
#pants {
}
#left-arm {
}
#right-arm {
}
#left-shoe {
}
#right-shoe {
}
<!doctype html>
<html>
<head>
<title>Avatar with CSS</title>
<link href="avatar.css" rel="stylesheet" type="text/css">
</head>
<body>
<!-- The graphic below was originally created with SVG-edit - http://svg-edit.googlecode.com/ -->
<!-- EXTRA CREDIT: Create your own shape at http://svg-edit.googlecode.com/ and paste it in between the tags "DRAWING START" and "DRAWING END"-->
<!-- DRAWING START -->
<svg width="320" height="480" viewBox="0 0 320 480">
<g class="avatar">
<path id="cape" d="m111,184l-58,192l231,-1l-81,-193l-92,2z"/>
<path id="head" class="body" d="m106,98c0,-29.28177 22.82321,-53 51,-53c28.17679,0 51,23.71823 51,53c0,29.28177 -22.82321,53 -51,53c-28.17679,0 -51,-23.71823 -51,-53z"/>
<path id="neck" class="body" d="m144,175l3,-23l22,0l6,22l-31,1z"/>
<path id="left-arm" class="arm left body" d="m84,219l-25,28l-27,-3l0,11l17,4l-19,17l3,9l22,-16l-13,26l6,6l18,-28l-4,29l9,0c1.33334,-10.33334 2.66666,-17.66666 4,-28l10,18l7,-5l-12,-27l21,-25l-17,-16z"/>
<path id="shirt" d="m144,175l-34,8l-28,31l20,19l21,-26l7,70l60,1l5,-71l16,17l21,-13l-29,-30l-26,-6l-33,0z"/>
<path id="right-arm" class="arm right body" transform="rotate(-80 251 252)" d="m269.5,210.5l-25,28l-27,-3l0,11l17,4l-19,17l3,9l22,-16l-13,26l6,6l18,-28l-4,29l9,0c1.33334,-10.33334 2.66666,-17.66666 4,-28l10,18l7,-5l-12,-27l21,-25l-17,-16z"/>
<ellipse id="left-shoe" class="shoe left" ry="21" rx="44" cy="410" cx="114"/>
<path id="pants" d="m131,278l-21,113l45,2l5,-62l15,63l43,-2l-28,-115l-59,1z"/>
<ellipse id="right-shoe" class="shoe right" ry="21" rx="44" cy="411" cx="213"/>
<ellipse id="left-eye" class="eye left" ry="8" rx="7" cy="98" cx="135"/>
<ellipse id="right-eye" class="eye right" ry="8" rx="7" cy="98" cx="176"/>
<path id="mouth" d="m142,127l37,-12l-6,17l-31,-5z"/>
</g>
</svg>
<!-- DRAWING END -->
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment