Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="cartoon">
  <div class="hair r"></div>
  <div class="hair-back"></div>
  <div class="neck"></div>
  <div class="ear r ha"></div>
  <div class="ear r ha"></div>
  <div class="face r">
    <div class="hair-tip r ha"></div>
    <div class="mouth ha hb"></div>
    <div class="nose r ha hb"></div>
    <div class="eye ha"></div>
    <div class="eye ha"></div>
  </div>
  <div class="legs ha hb"></div>
  <div class="pants"></div>
  <div class="arm-1 r ha"></div>
  <div class="arm-2 r"></div>
  <div class="hand r"></div>
  <div class="shirt ha"></div>
  <div class="shoe ha"></div>
  <div class="shoe ha"></div>
  <div class="pencil hb ha"></div>
</div>
              
            
!

CSS

              
                html, body {
  --bg: #fff; #9cf;
  background: var(--bg);
}

.cartoon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80vmin;
  height: 80vmin;
  overflow: hidden;
}


.cartoon div {
  position: absolute;
  box-sizing: border-box;
}

.b {
  border: 1vmin solid black;
}

.r {
  border-radius: 100%;
}

.hb::before,
.ha::after {
  content: "";
  display: block;
  position: absolute;
}

/****/
.cartoon {
  --skin: #fca;
  --shadow: #fb9;
  --light: rgba(255,255,255,0.2);
  --line: #ea8;
  --mouth: #411;
  --tongue: #822;
  --cheek: rgba(255,0,0,0.1);
  --teeth: #fff;
  --throat: #211;
  --shirt: #f45; #d31;#a12;
  --pants: #47a;
  --shoe: #222;
  --sock: #ddd;
  --pencil: #fd6;
  --eraser: #fab;
  --wood: #eba;
  --hair: #631;
}

.face {
  border-radius: 35% 35% 50% 50%;
  width: 30%;
  height: 30%;
  background: var(--skin); 
  box-shadow: inset 0vmin -2.5vmin 0 -1.5vmin var(--shadow), inset -0.5vmin 0.5vmin var(--light);
  top: 10%;
  left: 30%;
  transform: translate(-50%, 0);
}

.mouth {
  width: 25%;
  height: 20%;
  background: var(--mouth);
  border-radius: 0 0 25vmin 25vmin;
  top: 65%;
  left: 52%;
  transform:translate(-50%,0);
  overflow: hidden;
  background: linear-gradient(var(--skin) 5%, var(--mouth) 0);
}

.mouth::after {
  width: 200%;
  height: 20%;
  background:var(--skin);
  border-radius: 50%;
  left: 50%;
  top: -10%;
  transform: translate(-50%, 0);
  box-shadow: 0 0 0 1vmin var(--teeth);
}

.mouth::before {
  width: 60%;
  height: 80%;
  background: var(--tongue);
  border-radius: 50%;
  bottom: -40%;
  left: 0%;
  box-shadow: 2vmin 0 var(--tongue), 1vmin -3vmin 0 -1.5vmin var(--mouth), 1vmin -1vmin var(--throat);
}

.nose {
  width: 10%;
  height: 10%;
  box-shadow: 0.5vmin -0.5vmin var(--line);
  top: 50%;
  left: 50%;
  transform: translate(-50%, 0)
}

.nose::before {
  left: -7vmin;
  width: 200%;
  height: 100%;
  border-radius: 50%;
  background: var(--cheek);
  box-shadow: 12.5vmin 0 var(--cheek);
}

.ear {
  width: 5%;
  height: 5%;
  background: var(--skin);
  top: 23%;
  left: 12%;
}

.ear::after {
  width: 25%;
  height: 15%;
  border: 0.5vmin solid var(--line);
  transform: rotate(45deg);
  border-left-color: transparent;
   border-bottom-color: transparent;
  top: 35%;
  left: 13%;
  border-radius: 25% 50% 50% 25%;
}

.ear + .ear {
  transform: scaleX(-1);
  left: 43%;
}

.neck {
  width: 3.5%;
  height: 10%;
  top: 35%;
  left: 28.25%;
  background: var(--skin);
}

.shirt {
  width: 21%;
  height: 26%;
  background: var(--shirt);
  border-radius: 90% 90% 1vmin 1vmin / 120% 120% 80% 80%;
  top: 43%;
  left: 30%;
  transform: translate(-50%, 0);
  overflow: hidden;
  background: linear-gradient(var(--skin) 1%, var(--shirt) 0)
}

.shirt::after {
  width: 28%;
  height: 9%;
  border-radius: 50%;
  background: var(--skin);
  left: 50%;
  top: -0.25vmin;
  transform: translate(-50%, 0);
  box-shadow: 0 0 0 1vmin rgba(0,0,0,0.1);
}

.pants {
  width: 18%;
  height: 28%;
  background: var(--pants);
  border-radius: 100% 100% 1vmin 1vmin / 120% 120% 80% 80%;
  top: 50%;
  left: 30%;
  transform: translate(-50%, 0);
  background: linear-gradient(var(--pants) 85%, transparent 0), linear-gradient(-100deg, var(--pants) 56%, transparent 0), linear-gradient(98deg, var(--pants) 56%, transparent 0); , linear-gradient(to right, var(--pants) 47%, transparent 0 53%, var(--pants) 0);
}

.legs {
  width: 14%;
  height: 50%;
  aborder: 3vmin solid var(--skin);
  aborder-bottom: 2vmin solid transparent;
  box-shadow: inset 0 8vmin 0 3vmin var(--skin);
  border-radius: 50%;
  left: 30%;
  top: 55%;
  transform: translate(-50%, 0);
  overflow: hidden;
}

.legs::after {
  width: 20%;
  left: -5%;
  height: 5%;
  background: var(--cheek);
  top: 50%;
  border-radius: 50%;
} 

.legs::before {
  width: 12%;
  right: 1%;
  height: 5%;
  background: var(--cheek);
  top: 50%;
  border-radius: 50%;
} 

.shoe {
  width: 15%;
  height: 5%;
  background: var(--shoe);
  border-radius: 100% 40% 0% 0% / 130% 100% 50% 50%;
  bottom: 0;
  background: linear-gradient(var(--shoe) 80%, var(--sock) 0);
  left: 12.75%;
}

.shoe::after {
  width:40%;
  height: 30%;
  background: var(--sock);
  border-radius: 5vmin;
  right: -2%;
  transform: rotate(10deg);
  top: -10%;
  box-shadow: -0.25vmin -1vmin var(--sock);
  background-image: linear-gradient(5deg, var(--sock) 75%, rgba(0,0,0,0.08) 0)
}

.shoe + .shoe {
  transform: scaleX(-1);
  left: 32%;
}

.arm-1 {
  width: 20%;
  height: 21.5%;
  top: 49.5%;
  left: 15%;
  box-shadow: 0vmin -1vmin 0 3vmin var(--shirt), 1vmin -2.5vmin 0 2vmin var(--shirt);
  clip-path: polygon(-100% -100%, 50% -100%, 45% 150%, 0% 150%);
  transform: rotate(10deg);
}

.arm-1::after {
  width: 25%;
  height: 25%;
  background: var(--skin);
  border-radius: 50%;
  top: 93%;
  left: 30%;
  box-shadow: -2vmin -0.5vmin 0 -0.75vmin rgba(0,0,0,0.1), -2vmin -0.5vmin 0 -0.75vmin var(--shirt)
}

.arm-2 {
  width: 32%;
  height: 15%;
  box-shadow: -1vmin 1vmin 0 2vmin var(--shirt);
  transform: rotate(10deg);
  top: 36.5%;
  left: 35%;
  clip-path: polygon(0% 70%, 20% 90%, 90% 80%, 100% 150%, 0% 150%);
}

.pencil {
  width: 20%;
  height: 90%;
  background: var(--pencil);
  border-radius: 0 0 2vmin 2vmin;
  clip-path: polygon(2% 25%, 44% 5%, 49% 0.5%, 51% 0%, 56% 5%, 98% 25%, 98% 83%, 100% 84%, 100% 92%, 99% 93%, 99% 100%, 1% 100%, 1% 93%, 0% 92%, 0% 84%, 2% 83%);
  background-image: linear-gradient(#222 5%, var(--wood) 0 25%, transparent 0 90%, var(--eraser) 0), linear-gradient(to right, rgba(0,0,0,0.05) 30%, rgba(0,0,0,0.0005) 0 70%, rgba(0,0,0,0.05) 0);
  left: 56%;
  transform-origin: bottom right;
  transform: rotate(10deg);
  bottom: 0;
}

.pencil::after {
  width: 100%;
  height: 10%;
  background: #aaa;
  bottom: 7%;
  background-image: linear-gradient(transparent 50%, rgba(0,0,0,0.1) 0);
  background-size: 100% 25%;
}

.pencil::before {
  width: 40%;
  height: 2%;
  background: var(--wood);
  color: var(--wood);
  border-radius: 50%;
  top: 23.5%;
  left: 30%;
  box-shadow: -6.5vmin -0.25vmin, 6.5vmin -0.25vmin;
}

.hand {
  width: 6%;
  height: 6%;
  background: var(--skin);
  top: 47.5%;
  left: 63%;
  box-shadow: -2vmin 1vmin 0 -1vmin rgba(0,0,0,0.1), -2vmin 1vmin 0 -1vmin var(--shirt);
}

.eye {
  width: 23%;
  height: 13%;
  border-radius: 50%;
  box-shadow: 0 -1vmin var(--hair);
  transform: rotate(-13deg);
  top: 23%;
  left: 16%;
}

.eye::after {
  width: 100%;
  height: 50%;
  border-radius: 50%;
  box-shadow: 0 -0.5vmin 0 -0.25vmin black;
  transform: rotate(10deg);
  top: 150%;
  left: -15%;
}

.eye + .eye {
  transform: scaleX(-1) rotate(-12deg);
  left: auto;
  right: 15%;
}

.eye + .eye::after {
  left: -20%;
}

.hair-back {
  width: 32.5%;
  height: 37.5%;
  background: var(--hair);
  top: 3.5%;
  left: 30%;
  transform: translate(-50%, 0);
  border-radius: 100% / 80% 80% 105% 105%;
  background-image: linear-gradient(45deg, transparent 70%, rgba(0,0,0,0.3));
}

.hair-tip {
  width: 15%;
  height: 15%;
  box-shadow: 1vmin 0.10vmin var(--hair);
  left: 50%;
  transform: translate(-55%, -10%);
}

.hair-tip::after {
  width: 670%;
  height: 170%;
  background: var(--hair);
  border-radius: 50%;
  border-radius: 90% 100% 100% 20% / 100%;
  left: -270%;
  atransform: translate(-50%, 0);
  top: -140%;
  clip-path: polygon(0% 0%, 100% 0%, 90% 30%, 100% 50%, 90% 70%, 100% 100%, 0% 100%)
}

.hair {
  width: 8%;
  height: 16%;
  background: var(--hair);
  top: 10%;
  left: 12.75%;
} 
              
            
!

JS

              
                
              
            
!
999px

Console