JSFiddle - React, Tailwind, and code Playground
by Mukul kant
HTML
<div class="pencil">
<div class="eraser"></div>
<div class="ferrule"></div>
<div class="shaft"></div>
<div class="lead"></div>
</div>
CSS
.pencil {
width:40px;
margin:-200px auto;
transform:rotate(90deg);
-ms-transform:rotate(90deg); /* IE 9 */
-webkit-transform:rotate(90deg); /* Safari and Chrome */
}
.pencil:before {
content: "";
position: absolute;
height:512px;
width:8px;
background: rgba(0,0,0,.4);
border-radius: 50%;
margin-left:35px;
margin-top:-2px;
}
.pencil .eraser {
height:35px;
width:40px;
background: #EC87C0;
-webkit-border-top-left-radius: 10px;
-webkit-border-top-right-radius: 10px;
-moz-border-radius-topleft: 10px;
-moz-border-radius-topright: 10px;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}
.pencil .eraser:before {
content: "";
position: absolute;
width:20px;
height:35px;
margin-left:20px;
background: #D770AD;
-webkit-border-top-right-radius: 10px;
-moz-border-radius-topright: 10px;
border-top-right-radius: 10px;
}
.pencil .ferrule {
height:45px;
width:40px;
background: #CCD1D9;
}
.pencil .ferrule:before {
content: "";
position:absolute;
height:45px;
width:20px;
margin-left:20px;
background: #AAB2BD;
}
.pencil .shaft {
height:350px;
width:40px;
background: #FFCE54;
}
.pencil .shaft:before {
content: "";
position: absolute;
height: 350px;
width: 20px;
margin-left: 20px;
background: #FCBB42;
}
.pencil .lead {
border-left: 20px solid transparent;
border-right: 20px solid transparent;
border-top: 80px solid #EBD4A9;
}
.pencil .lead:before {
content: "";
position: absolute;
margin-top: -80px;
border-right: 20px solid transparent;
border-top: 80px solid #D1BD97;
}
.pencil .lead:after {
content: "";
position: absolute;
margin-top:-21px;
margin-left:-5px;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-top: 20px solid #1A1A1A;
}