Skip to content

Instantly share code, notes, and snippets.

@gorlandor
Created March 5, 2017 03:53
Show Gist options
  • Save gorlandor/485f7e3425ad9bc16967b70d8d4a6fea to your computer and use it in GitHub Desktop.
Save gorlandor/485f7e3425ad9bc16967b70d8d4a6fea to your computer and use it in GitHub Desktop.
Elephant
<div class="elephant flex-vertically">
<div class="ears flex-horizontally">
<div class="ear left-ear flex-vertically">
<div class="inner-ear"></div>
</div>
<div class="ear right-ear flex-vertically">
<div class="inner-ear"></div>
</div>
</div>
<div class="face flex-vertically">
<div class="eyes flex-horizontally">
<div class="eye flex-vertically">
<div class="retina"></div>
</div>
<div class="eye flex-vertically">
<div class="retina"></div>
</div>
</div>
<div class="nose"></div>
</div>
<div class="peanut flex-horizontally">
<div class="peanut-left"></div>
<div class="peanut-right"></div>
</div>
<div class="body">
<div class="legs flex-horizontally">
<div class="leg left-leg"></div>
<div class="leg right-leg"></div>
</div>
</div>
</div>
:root {
--primary-color: #91A3B0;
--outline-color: #505050;
--peanut-base-color: #D0B078;
--peanut-outline-color: #7a4434;
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100vh;
background-color: teal;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.flex-vertically {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.flex-horizontally {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.face {
width: 192px;
height: 192px;
background-color: var(--primary-color);
border-radius: 96px;
z-index: 2;
border: 1px solid var(--outline-color);
}
.body {
width: 224px;
height: 180px;
background-color: var(--primary-color);
border-radius: 96px;
position: relative;
bottom: 6em;
z-index: 0;
}
.legs {
padding-top: 8em;
}
.leg {
width: 64px;
height: 72px;
border-left: 1px solid var(--outline-color);
border-right: 1px solid var(--outline-color);
border-bottom: 1px solid var(--outline-color);
border-bottom-right-radius: 0.75em;
border-bottom-left-radius: 0.75em;
background-color: var(--primary-color);
}
.leg.left-leg {
margin-right: 1em;
}
.leg.right-leg {
margin-left: 1em;
}
.nose {
width: 52px;
height: 80px;
border-left: 1px solid var(--outline-color);
border-right: 1px solid var(--outline-color);
border-bottom: 1px solid var(--outline-color);
border-bottom-right-radius: 1em;
border-bottom-left-radius: 1em;
position: relative;
top: 2.5em;
background-color: var(--primary-color);
}
.ear {
width: 128px;
height: 128px;
border-radius: 64px;
margin-bottom: -4em;
background-color: var(--primary-color);
border: 1px solid var(--outline-color);
}
.ear.left-ear {
margin-right: 2em;
}
.ear.right-ear {
margin-left: 2em;
}
.inner-ear {
width: 96px;
height: 96px;
border-radius: 48px;
background-color: pink;
border: 1px solid var(--outline-color);
}
.eyes {
position: relative;
bottom: -1.5em;
}
.eye {
width: 72px;
height: 72px;
border-radius: 36px;
background-color: white;
margin: 0 0.25em;
border: 1px solid var(--outline-color);
}
.retina {
width: 48px;
height: 48px;
border-radius: 24px;
background-color: black;
}
.peanut {
z-index: 1;
}
.peanut-left {
width: 2em;
height: 2em;
margin-right: -0.2em;
border-radius: 0.85em;
border-bottom-right-radius: 0.625em;
background-color: #D0B078;
border-left: 2px solid #7a4434;
border-bottom: 2px solid var(--peanut-outline-color);
}
.peanut-right {
width: 2em;
height: 2em;
border-radius: 0.85em;
border-bottom-left-radius: 0.625em;
background-color: var(--peanut-base-color);
border-right: 2px solid var(--peanut-outline-color);
border-bottom: 2px solid var(--peanut-outline-color);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment