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>
  <h2>Using three different methods of the <code>CSSStyleDeclaration</code> API</h2>

  <div class="box">
    <p>Some example text.</p>  
  </div>

  <p>Color for box is: <output></output></p>
  
  <p>The following properties are defined on the box's inline styles: <output></output></p>
  
  <p>Using <code>setProperty()</code>, <code>getPropertyValue()</code>, and <code>item()</code> — all methods of the <code>style</code> object — you can get or set inline styles on elements.</p>
</main>
              
            
!

CSS

              
                * {
  box-sizing: border-box;
}

body {
  padding: 0 20px;
  line-height: 1.4;
  font-size: 1.3em;
  font-family: Helvetica, Arial, sans-serif;
}

main {
  max-width: 700px;
  margin: 0 auto;
}

code, output {
  color: firebrick;
  font-family: Consolas, monospace;
}

.box {
  border: solid 1px #ccc;
  padding: 0 10px;
}
              
            
!

JS

              
                let box = document.querySelector('.box'),
    op = document.querySelector('output'),
    op2 = document.querySelectorAll('output')[1];

box.style.setProperty('color', 'orange');
box.style.setProperty('font-family', 'Georgia, serif');
op.innerHTML = box.style.getPropertyValue('color');
op2.innerHTML = `${box.style.item(0)}, ${box.style.item(1)}`;
              
            
!
999px

Console