Pen Settings



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


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


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.


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.


                <h1>Normal Document Flow in HTML</h1>
<div class="border dib">This is a div. 
  <span> This is a span.</span>
  This is still the same div.
  <span>Some more text.</span>
  <img src="" />
  <span>There is a whole lot of text here.</span>

<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
  <p>This is a paragraph in a div.</p>
  <div>This is a div in a div.</div>


                .border { border: 1px solid gray }
.dib { display: inline-block }

1. In this example, we can see that images are behaving similar to <span> elements. Actually, their display is set to inline-block - which means that the browser will render images with top and bottom margins on if we set these margins in our CSS.
2. Let's say we want to have an image on the right or the left side of its container (its parent div). How do we do that? We'll see that next.