Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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

Save Automatically?

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

              
                <section>
  <h2 class="full-width-borders">Full-Width Bar with Borders</h2>
  <p>This approach uses negative margins and padding to extend the background in both directions. This works great if you're using a single background color for the bar.</p>
  <p>But you can also make the Bar color different from the h2 background color by using borders, as long as you can use a solid color (RGBa values will tint the background color of the heading, and there's an issue with Safari 7, where RGBa borders display a tiny gap.)</p>
  <p>There's also a bug using super-wide borders in Chrome: You need to make them exactly 9600 or 10240px (or equivalent in ems or rems) or the positioning is off.</p>
  <p>If you want to use an RGBa value for the Bar but a different color for the heading background, you can add a <code>:before</code> <a href="https://codepen.io/parkerbennett/pen/GgqPWq" target="_blank">pseudo-element</a> with absolute positioning and a negative z-index.</p>
  <p>For more flexibility, e.g., different colors, heights, widths, gradient fades, etc., you can use <a href="https://codepen.io/parkerbennett/pen/raLaYb" target="_blank">two pseudo-elements</a>.
  </div>
</section>
              
            
!

CSS

              
                /* on both */
html, body {
  overflow-x: hidden;
}
body {
  background: #ccc;
}
section {
  box-sizing: border-box; /* or not */
  margin: 0 auto;
  width: 25rem;
  background: white;
  padding: 1.5rem;
  padding-bottom: 4rem;
}
h2, .full-width-borders {
  /* add in section padding (1.5rem) */
  margin: 0 -601.5rem;
  /* match section padding (1.5rem) */
  padding: .25rem 1.5rem;
  background: red;
  /* border solid, not RGBa (Safari bug) */
  /* 9600px or 10240px to avoid Chrome bug */
  /* or equivalent in ems or rems (9600/16) */
  border-left: 600rem solid maroon;
  border-right: 600rem solid maroon;
  color: white;
  font-size: 1.125rem;
}

              
            
!

JS

              
                
              
            
!
999px

Console