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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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>
  <h3>This grid uses <code>minmax(100px, 250px)</code> for the first column</h3>
<div id="grid-minmax-0" class="grid">
   <div class="item">      
     <img class="kitten" alt="Kitten">
   </div>
   <div class="item">                    
     <img class="kitten" alt="Kitten">
   </div>
   <div class="item">                    
     <img class="kitten" alt="Kitten">
   </div>                                
     <div class="item">                    
     <img class="kitten" alt="Kitten">
   </div>
   <div class="item">                    
     <img class="kitten" alt="Kitten">
   </div>                                
</div>
</section>

<section>
  <h3>This grid uses <code>minmax(50px, max-content)</code> for the rows</h3>
<div id="grid-minmax-1" class="grid">
   <div class="item">      
     <p>Meow see owner, run in terror refuse to drink water except out of someone's glass and walk on car leaving trail of paw prints on hood and windshield claw at curtains stretch and yawn nibble on tuna ignore human bite human hand. Russian blue shove bum in owner's face like camera lens but cat fur is the new black hide head under blanket so no one can see. Meow for food, then when human fills food dish</p>
   </div>
   <div class="item">                         
   </div>
   <div class="item">                         
   </div>                                
  <div class="item">                    
    <p>Meow see owner, run in terror refuse to drink water except out of someone's glass and walk on car leaving trail of paw prints on hood and windshield claw at curtains stretch and yawn nibble on tuna ignore human bite human hand.</p>
   </div>
   <div class="item">                    
   </div>                                
</div>
</section>
              
            
!

CSS

              
                .grid {
    display: grid;
    grid-gap: 20px;    
}

#grid-minmax-0 {
  grid-auto-rows: 200px;
  grid-template-columns: minmax(100px, 250px) 1fr 1fr 1fr
}

#grid-minmax-1 {
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: minmax(50px, max-content);
    
}

.grid .item {
    background-color: gainsboro;
    border: 2px solid grey;
    border-radius: 3px;  
    text-align: center;    
    display: flex;      
    justify-content: center;
    align-items: center;
}

.grid .item:nth-child(odd) {
    background-color: lavender;
    border: 2px solid grey;
}

section {
  margin-top: 50px;
}
              
            
!

JS

              
                 class PlaceKittenUrl {
   constructor() {
     this.height = 100
     this.width = 100
     this.image = Math.floor(Math.random() * 16)
   }        

   height(newHeight) {
     this.height = newHeight
     return this
   }

   width(newWidth) {
     this.width = newWidth
     return this
   }

   url() {
     return  `https://placekitten.com/${this.width}/${this.height}?image=${this.image}`
   }
 }

const section1Kittens = document.getElementsByClassName("kitten")
for(const kitten of section1Kittens) {
  kitten.src = new PlaceKittenUrl().url()       
}
              
            
!
999px

Console