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

              
                <html>
  <div class="head">
  <p>I am a paragraph, a block element, taking the full-width of the page just like my container, div. "See my borders"</p>
  <p>
    I am an <span class="span-1">inline span element</span> inside a block element. They allow me space on the right/left but nothing on top/bottom :(
  </p>
  <p>
    Here comes the best of both-worlds, inline-block. The <span class=span-2>inline-block</span> to the rescue. 
  </p>
</div>
<h1>I am another block-level element just stretching out.</h1>
<h2>Am a smaller heading yet a block element. But, you can override my behaviour by changing the display property.</h2>
</html>
              
            
!

CSS

              
                /*Basic CSS reset */

html, 
body {
    /*look how you get the entire box/browser window to play around. Another topic for another day though.*/
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: sans-serif, Arial;
}

*, *::before, *::after {
    box-sizing: inherit;
}

/* Block element styles */
.head {
  background-color: #f1425d;
  color: #fff;
  height: 280px;
}

.head p {
  padding: 10px;
  border: 5px solid #39ff14;
}

/* Span styles */

.span-1, .span-2 {
  background-color: #000;
  color: white;
  width: 100%; /* oh common, I am an inline element */
}

.span-1 {
  margin-top: 50px; /*nothing happens*/
  padding: 5px 30px;
}

.span-2 {
  display: inline-block;
  /* check these out */
  margin-top: 10px;
  margin-bottom: 10px;
}

/* Overriding h2's default behaviour (not the actual type) making in an inline element. */

h1 {
    border: 2px solid red;
    padding: 10px;
    margin-top: 10px;
}

h2 {
  border: 2px solid purple;
  padding: 10px;
  margin-top: 20px; /* Now, I can't make this happen. */
  display: inline; /* but you can fit another element (img?) next to me! */
  width: 100%: /* why? but why? told you won't work :p */
  height: 500px; /* okay, bye! */
}
              
            
!

JS

              
                
              
            
!
999px

Console