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

              
                <main>  
<h1>Some Page</h1>
    <p>Lorem ipsum dolor sit amet, id vivendo apeirian accommodare sea. His adhuc tation omittantur no, mei ne vocent scripta ancillae. Choro quando eu vix, et dicant exerci fierent cum, vis constituto reprehendunt in. Mel te munere numquam. Vis no commune placerat eleifend, no soluta recteque ius, dolorum mediocrem vim ex. Eu graeci tacimates evertitur sit, an nec vide dicta.</p>
    <figure>
      <img src="http://placehold.it/200x150" width="200" height="150" alt="test">
      <figcaption>This caption is a bit long and is wider than the image, taking up too much space</figcaption>
    </figure>
    <p>Nihil insolens vulputate eam cu, nam elitr deleniti vituperata in, no primis scripta usu. Eam ex ridens euripidis assueverit. In autem docendi per. His ubique vivendo constituto an, omnes elaboraret vis ea. Eu quo impedit platonem interesset, eum id nullam quaeque tacimates. Invenire qualisque qui ut, an nam autem iriure prompta.</p>
    <p>Usu eu vidit numquam. Eu has tollit perfecto. Ea sea invenire adolescens, mea ornatus omnesque id, cum at novum dolore. Discere legimus in nec. Cibo aeque tamquam his ad. Diam causae inermis at his, sint fabellas singulis sit ut.</p>
    <figure class="capfit">
      <img src="http://placehold.it/200x150" width="200" height="150" alt="test">
      <figcaption>This caption is also long, but wraps to the size of the image.</figcaption>
    </figure>
    <p>Lorem ipsum dolor sit amet, id vivendo apeirian accommodare sea. His adhuc tation omittantur no, mei ne vocent scripta ancillae. Choro quando eu vix, et dicant exerci fierent cum, vis constituto reprehendunt in. Mel te munere numquam. Vis no commune placerat eleifend, no soluta recteque ius, dolorum mediocrem vim ex. Eu graeci tacimates evertitur sit, an nec vide dicta.</p>
    <p>Nihil insolens vulputate eam cu, nam elitr deleniti vituperata in, no primis scripta usu. Eam ex ridens euripidis assueverit. In autem docendi per. His ubique vivendo constituto an, omnes elaboraret vis ea. Eu quo impedit platonem interesset, eum id nullam quaeque tacimates. Invenire qualisque qui ut, an nam autem iriure prompta.</p>
    <p>Usu eu vidit numquam. Eu has tollit perfecto. Ea sea invenire adolescens, mea ornatus omnesque id, cum at novum dolore. Discere legimus in nec. Cibo aeque tamquam his ad. Diam causae inermis at his, sint fabellas singulis sit ut.</p>
    <p>Lorem ipsum dolor sit amet, id vivendo apeirian accommodare sea. His adhuc tation omittantur no, mei ne vocent scripta ancillae. Choro quando eu vix, et dicant exerci fierent cum, vis constituto reprehendunt in. Mel te munere numquam. Vis no commune placerat eleifend, no soluta recteque ius, dolorum mediocrem vim ex. Eu graeci tacimates evertitur sit, an nec vide dicta.</p>
</main>
              
            
!

CSS

              
                body {
  background: #333;
  font-family: sans-serif;
}
main {
  background: #fff;
  width: 90%;
  max-width: 50em;
  margin: 0 auto;
  text-align: center;
}
p,
h1 {
  margin: 1em;
  text-align: justify;
}
figure {
  font-style: italic;
  font-family: serif;
}
img {
  max-width: 100%;
  height: auto;
}
.capfit {
  display: inline-table;
  width: 1%;
  margin: 1em auto;
}
.capfit img {
  max-width: calc(100vw - 4em);
}
@media screen and (min-width: 28em) {
  figure {
    float: right;
  }
  .capfit {
    width: 1%; /* Shrink to fit */
    margin: 1em;
  }
  .capfit img {
    max-width: calc(50vw - 4em); /* Squeeze image before breakpoint */
  }
}

              
            
!

JS

              
                
              
            
!
999px

Console