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 class="deals">
  <article class="sale-item">
    <h1>Computer Starter Kit</h1>
    <p>This is the best computer money can buy, if you don’t have much money.</p>
    <ul>
      <li>Computer</li>
      <li>Monitor</li>
      <li>Keyboard</li>
      <li>Mouse</li>
    </ul>
    <img src="https://www.w3.org/TR/css-flexbox-1/images/computer.jpg" alt="You get: a white computer with matching peripherals">
    <button>BUY NOW</button>
  </article>
  
  <article class="sale-item">
    <h1>Printer</h1>
    <p>Only capable of printing ASCII art.</p>
    <ul>
      <li>Paper and ink not included.</li>
    </ul>
    <img src="https://www.w3.org/TR/css-flexbox-1/images/printer.png"
         alt="You get: a dot-matrix printer.">
    <button>BUY NOW</button>
  </article>

  <article class="sale-item">
    <h1>Printer 2</h1>
    <p>A la 1989.</p>
    <img src="https://www.w3.org/TR/css-flexbox-1/images/printer.png"
         alt="You get: a dot-matrix printer.">
    <button>BUY NOW</button>
  </article>

  <article class="sale-item">
    <h1>Mouse</h1>
    <p>A computer mouse is a pointing device (hand control) that detects two-dimensional motion relative to a surface. This motion is typically translated into the motion of a pointer on a display, which allows a smooth control of the graphical user interface. Clickity Click!</p>
    <button>BUY NOW</button>
  </article>

  <article class="sale-item">
    <h1>Macintosh 8500</h1>
    <p>This is the best computer money can buy, if you don’t have much money. This computer was state of the art in 1995.</p>
    <img src="https://www.w3.org/TR/css-flexbox-1/images/computer.jpg"
         alt="You get: a white computer with matching peripherals.">
    <button>BUY NOW</button>
  </article>
</main>
              
            
!

CSS

              
                * {
  box-sizing: border-box;
}
body {
  padding: 1rem;
}

/* Just for the fallback layout */

main {
  max-width: 500px;
  margin: 0 auto;
}
article {
  margin: 1rem 0;
}

/* Now lets do a Grid-based layout */

@supports (display: grid) {
  main { 
    max-width: 10000px;
    margin: 0;
  }
  article {
    margin: 0;
  }
  .deals {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    grid-gap: 1rem;
  }
}
  
.deals {
  font-family: Avenir, Roboto, Helvetica, san-serif; 
  font-size: 80%;
}
.sale-item {
  display: flex;
  flex-flow: column;
  border:  1px solid black;
  border-radius: 1rem;
  padding: 2rem;
}
.sale-item > h1 {
  margin: 1rem 1rem 0;
}
.sale-item > ul {
  margin: 0 0 1rem;
}
.sale-item > p {
  margin: 0.25em 1rem 1rem;
}
.sale-item > img {
  order: -1;
  align-self: center;
}
.sale-item > button {
  margin-top: auto; 
  background: teal;
  color: white;
  padding: 0.5rem;
  border: none;
  border-radius: 1rem;
  font-size: 1.2rem;
}

              
            
!

JS

              
                
              
            
!
999px

Console