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="container">
  <label id="bff"> Best Friends: </label>
  <div class="ruler">
    <div class="cm"> </div>
    <div class="mm"> </div>
    <svg id="smiley" viewBox="0 0 532 372" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
        <g id="Face">
            <ellipse id="eye-left" fill="#000000" cx="72.5" cy="68.5" rx="72.5" ry="68.5"></ellipse>
            <ellipse id="eye-right" fill="#000000" cx="459.5" cy="68.5" rx="72.5" ry="68.5"></ellipse>
            <path d="M145,236.5 C145,401.46875 386.59375,406.03125 386.59375,233" id="Mouth" stroke="#444" stroke-width="20"></path>
        </g>
    </g>
</svg>
  </div>
  <div class="pencil">
  <div class="pencil_body"> </div>
</div>

<label id="enemy"> Enemy: </label>
<div class="eraser"><?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg id="evil" viewBox="0 0 532 447" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">

    <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
        <g id="evil-face" transform="translate(0.000000, 20.000000)">
            <ellipse id="eye-left" fill="#000000" cx="72.5" cy="207.5" rx="72.5" ry="68.5"></ellipse>
            <ellipse id="eye-right" fill="#000000" cx="459.5" cy="207.5" rx="72.5" ry="68.5"></ellipse>
            <path d="M327,128.3125 L454.700035,0.612465434" id="Path-4" stroke="#444" stroke-width="40" stroke-linecap="round"></path>
            <path d="M66,132.3125 L193.700035,4.61246543" id="Path-4" stroke="#444" stroke-width="40" stroke-linecap="round" transform="translate(130.000000, 68.500000) scale(1, -1) translate(-130.000000, -68.500000) "></path>
            <path d="M155.506345,393.717848 C155.506345,393.717848 277.353252,417.491899 319.443845,393.717848 C361.534438,369.943797 376.756345,268.749098 376.756345,268.749098" id="Path-7" stroke="#444" stroke-width="35" stroke-linecap="round" transform="translate(266.131345, 336.516596) rotate(20.000000) translate(-266.131345, -336.516596) "></path>
        </g>
    </g>
</svg></div>
</div>




              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Caveat');

body {
  background: #F0E8DA;
  font-family: 'Caveat', cursive;
}

.container {
  position: absolute;
  margin: auto;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  width: 500px;
  height: 250px;
}

svg#smiley {
  position: absolute;
  top: 35px; left: 220px;
  width: 50px;
}

svg#evil {
  z-index: 5;
  position: absolute;
  width: 50px;
  top: 20px; left: 50px;
}

.pencil {
  position: absolute;
  margin: auto;
  top: 50px;
  bottom: 0;
  left: 0;
  right: 0;
  width: 500px;
  height: 100px;
}

.ruler {
  position: absolute;
  width: 500px;
  height: 80px;
  background: #FCAB10;
  border-radius: 3px;
  box-shadow: 2px 2px 10px #666;
}

.cm {
  position: absolute;
  left: 15px;
  width: 3px;
  height: 30px;
  background: #555;
}

.mm {
  position: absolute;
  left: 30px;
  width: 3px;
  height: 25px;
  background: #555;
}

#line {
  position: absolute;
}

#mm {
  position: absolute;
}

.pencil_body {
  position: absolute;
  width: 450px;
  height: 30px;
  background: #7BC950;
  border-radius: 5px;
}

.pencil_body:before {
  position: absolute;
  left: 445px;
  content: '';
  width: 30px;
  height 30px;
  border-left: 60px solid #D4915D;
  border-top: 15px solid transparent;
  border-bottom: 15px solid transparent;
}

.pencil_body:after {
  position: absolute;
  top: 8px;
  left: 475px;
  content: '';
  width: 30px;
  height 30px;
  border-left: 30px solid #333;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
}

#eye-right, #eye-left {
  fill: #444;
}

.eraser {
  position: absolute;
  top: 200px; left: 0;
  width: 150px;
  height: 80px;
  background: #C0C5C1;
  border-radius: 3px;
  box-shadow: 2px 2px 5px #666;
}

.eraser:before {
  position: absolute;
  left: 150px;
  content: '';
  width: 30px;
  height: 80px;
  background: #FFF;
  box-shadow: 2px 2px 5px #666;
}

#enemy {
  position: absolute;
  top: 155px; left: 0;
  font-size: 27px;
  
}

#bff {
  position: absolute;
 top: -45px;
  font-size: 27px;
}
              
            
!

JS

              
                function makeLines(num, left) {
  if (num > 0 & left < 450) {
    left += 30;
    var cm = '<div class="cm" id="line' + num + '"></div>';
    var mm = '<div class="mm" id="mm' + num + '"></div>';
    $('.ruler').append(cm);
    $('.ruler').append(mm);
    $('#line' + num).css('left', left);
    $('#mm' + num).css('left', left + 15);
    num--;
    makeLines(num, left);
  }
}

makeLines(25, 15);
              
            
!
999px

Console