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

              
                <div class="cards">
  <div class="card">
    <header>
      <h2>Bristol</h2>
    </header>
    
    <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/12005/harbour1.jpg" alt="Bristol harbour">
    <div class="body">
    <p>I live in Bristol. It mostly rains, but when it isn't raining we have hot air balloons.</p>
    </div>
    
  </div>
  
  <div class="card">
    <header>
      <h2>Harbour Cranes</h2>
    </header>
    
    <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/12005/harbour2.jpg" alt="Bristol harbour">
    <div class="body">
    <p>We also have giant cranes, and historic boats. It is best if the balloons avoid these.</p>
    </div>
  </div>
  
  <div class="card">
    <header>
      <h2>Striped Balloon</h2>
    </header>
    
    <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/12005/coloured-balloon.jpg" alt="Coloured balloon">
    <div class="body">
    <p>I like the nice standard balloons. Stripy. Solid looking basket.</p>
    </div>
  </div>
  
  <div class="card">
    <header>
      <h2>Fortnum &amp; Mason</h2>
    </header>
    
    <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/12005/champagne-balloons.jpg" alt="Fortnum and Mason balloon">
    <div class="body">
    <p>This one uses the correct Pantone colour for Fortnum and Mason.</p>
    </div>
  </div>
  
  <div class="card">
    <header>
      <h2>Funfair Problems</h2>
    </header>
    
    <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/12005/funfair-balloons.jpg" alt="Funfair">
    <div class="body">
    <p>Here we have balloons getting tangled up with a funfair.</p>
    </div>
  </div>
  
  
  
  
  
</div>
              
            
!

CSS

              
                .cards {
  display:grid;
  grid-template-columns: repeat(6,[col] 1fr [col2] 1fr);
  grid-gap: 10px;
}

.card:nth-child(1) {
  grid-column: col 1 / col2 2;
}

.card:nth-child(2) {
  grid-column: col 1 / col2 2;
  grid-row: 2;
}

.card:nth-child(3) {
  grid-column: col2 5 / col 7;
  grid-row: 2;
}

.card:nth-child(4) {
  grid-column: col2 2 / col2 5;
}

.card:nth-child(5) {
  grid-column: col2 5 / col 7;
}







html {
  box-sizing: border-box;
}
*, *:before, *:after {
  box-sizing: inherit;
}

body {
  font: 1em/1.4 Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
  background-color: #fafafa;
}

img {
  max-width: 100%;
}

.cards {
  margin: 0 auto;
  max-width: 960px;
}

.card {
  background-color: #fff;
  box-shadow: 0 2px 2px 0 rgba(0,0,0,.14),0 3px 1px -2px rgba(0,0,0,.2),0 1px 5px 0 rgba(0,0,0,.12);
}

.card header {
  padding: 10px;
  background-color: rgb(41,73,130);
  color: #fff;
}

.card header h2 {
  font-size: 1.4rem;
  font-weight: normal;
  margin: 0;
  padding: 0;
}

.card .body {
  padding: 10px;
  font-size: .9rem;
  color: #757575;
}


              
            
!

JS

              
                
              
            
!
999px

Console