cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-personicon-teamoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

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.

            
              <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>
            
          
!
            
              * {
  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;
}

            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console