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 and body are 'block' -->

<header>
  <nav>
    <a href='#'>Link one</a>
    <a href='#'>Link two</a>
  </nav>
  
  <h1>Heading level <span>1</span> ← (showing a span)</h1>
  
  <p>Each element has a default 'display: type.' There are 3 types: block, inline, and inline-block.</p>

  <p>Some things are <em>emphasized</em>, or even - <strong>strong</strong>ly emphasised. You can even select ran<span>dom 'spans' of inline char</span>acters. links are inline - and so is <code>code</code> and <mark>marked (highlighted)</mark> text. <code>display: inline;</code> elements wrap like a regular word inside a paragraph. They don't have all of the same properties as block level elements. Inline elemens don't have children. An <a href='#'>inline link</a> works like this... but - you also will want to turn links into <em>blocks</em>, so that you can "put stuff in them."</p>
  
  <p>The <code>display: block;</code> level elements will have a light blue box - and  the <code>display: inline;</code> elements will have a salmon box.</p>
  
  <p>And what about this whacky <code>display: inline-block;</code> element: <img src='https://assets.codepen.io/4806767/down.gif' width='50'>? I'll put a purple border on those ones.</p>
</header>


<main>
  <section>
    <h2>Heading level 2</h2>
    
    <p>Some paragraph type thing</p>
    
    <h3>Heading level 3</h3>
    
    <ul>
      <li>
        <p>You can have a paragraph in a list item - or really anything you want.</p>
      </li>
      <li>You'll likely have some <a href='#'>Links</a>.</li>
      <li>List item 1</li>
    </ul>
  </section>
  
  <section class='float-example'>
    <img src='https://assets.codepen.io/4806767/gradient.png' width='200'>
    
    <h2>Image float example</h2>

    <p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Asperiores quos quidem, alias hic ducimus nulla tenetur consequatur laudantium nihil omnis repellendus libero. Non porro facilis unde, ab veniam vero nesciunt?</p>

    <p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Asperiores quos quidem, alias hic ducimus nulla tenetur consequatur laudantium nihil omnis repellendus libero. Non porro facilis unde, ab veniam vero nesciunt?</p>

    <p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Asperiores quos quidem, alias hic ducimus nulla tenetur consequatur laudantium nihil omnis repellendus libero. Non porro facilis unde, ab veniam vero nesciunt?</p>
  </section>
</main>
              
            
!

CSS

              
                
* {
  padding: 3px;
  box-sizing: border-box; /* for later ! */
}

/* we haven't talked about this yet, but you can target many selectors with one rele */
html, body, header, main, section, h1, h2, h3, h4, p, ul, li {
  background-color: rgba(0, 100, 100, 0.1);
  border: 1px solid rgba(0, 0, 0, 0.2);
}

em, strong, span, code, mark, a {
  background-color: salmon;
}

img {
  border: 3px solid purple;
  vertical-align: middle; 
  /* 
    inline-block can do this 
    so - it has the ability to set size, margin, padding - but also some 'inline' type abilities. A little of both / but also - used very little now...
  */
}

.float-example img {
  float: left;
  margin-right: 10px;
  opacity: .8;
}

p, li {
  line-height: 1.5;
  max-width: 80ch;
}












code {
  background-color: darkgray;
  color: white;
}
              
            
!

JS

              
                
              
            
!
999px

Console