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="old-and-busted">
  <h1>The Old way is saying:</h1>
  <p>"Dear browser, this image is 300px wide. CSS will be taking over now."</p>
  <img src="http://www.csskarma.com/images/tim.jpg" width="300" alt="Tim's stupid face, it's the only image I had on hand." class="the-old-way">
</div>
  
<div class="new-hotness">
  <h1>The new way is saying:</h1>
  <p>
    "Dear Web Browser, this image is naturally 300px wide. When the viewport is larger than 800px, please make it 33% of the window. Otherwise it should be 100% of the window."
  </p>
  <img srcset="http://www.csskarma.com/images/tim.jpg 300w" sizes="(min-width: 800px) 33.3vw, 100vw" alt="Tim's stupid face, it's the only image I had on hand.">
</div>
              
            
!

CSS

              
                body {
  margin: 0;
  padding: 40px;
}

/*
  CSS for the old way, because the new way wouldn't 
  require CSS (in this case)
*/

/* under 800px */
.the-old-way {
  /* 100% of the viewport width */
  width: 100vw;
}

/* 800px and up */
@media screen and (min-width: 800px) {
  .the-old-way {
    /* 33.3% of the viewport width */
    width: 33.3vw;
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console