Pen Settings



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


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


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.


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.


  <h2 class="full-width">Full-Width Bar Using Pseudo-Elements</h2>
  <p>Using :before and :after pseudo-elements, we can extend the apparent background of the h2 element beyond the &lt;section&gt; it's contained in.</p>
  <p>Unfortunately, this triggers a horizontal scrollbar, so we need to set both the html and body elements to overflow-x: hidden.</p>
  <p>Unless you need the added flexibility of styling both sides (different colors, heights, widths, gradients, etc.) there's a simpler approach using <a href="" target="_blank">negative margins and padding</a>.</p>


                /* both */
html, body {
  overflow-x: hidden;
body {
  background: #ccc;
section {
  box-sizing: border-box; /* or not */
  margin: 0 auto;
  width: 25rem;
  background: white;
  padding: 30px;
  padding-bottom: 60px;
.full-width {
  position: relative; /* child absolute */
  /* negative offset = section padding */
  margin: 0 -30px;
  /* add back section padding value */
  padding: .25rem 30px;
  background: #333;
  background: rgba(0,0,0,.8);
  color: white;
  font-size: 1.125rem;
.full-width:before, .full-width:after{
  content: "";
  position: absolute;
  /* fill vertically */
  top: 0;
  bottom: 0;
  width: 9600px;
  right: 100%;
  background: red;
.full-width:after { 
  width: 320px;
  left: 100%;
  /* not browswer prefixed */
  background: green;