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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

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

              
                <div class="warning"><strong>Warning:</strong> Your browser does not support CSS container queries. Please open this demo in Chrome Canary with the experimental <i>#enable-container-queries</i> flag turned on.</div>

<div class="parent-grid">
  <div class="container">
    <div class="card">
      <div class="visual"></div>
      <div>
        <div class="meta">
          <h1>Card Title</h1>
          <h2 class="subtitle">Subtitle</h2>
        </div>
          <p class="desc">Here is some descriptive text. It's optional text to support the main idea of the card, and it will be hidden when this card has less inline space.</p>
        <button>I'm a button</button>
      </div>
    </div>
  </div>
  <div class="container">
    <div class="card">
      <div class="visual"></div>
      <div>
        <div class="meta">
          <h1>Card Title</h1>
          <h2 class="subtitle">Subtitle</h2>
        </div>
          <p class="desc">Here is some descriptive text. It's optional text to support the main idea of the card, and it will be hidden when this card has less inline space.</p>
        <button>I'm a button</button>
      </div>
    </div>
  </div>
  <div class="container">
    <div class="card">
      <div class="visual"></div>
      <div>
        <div class="meta">
          <h1>Card Title</h1>
          <h2 class="subtitle">Subtitle</h2>
        </div>
          <p class="desc">Here is some descriptive text. It's optional text to support the main idea of the card, and it will be hidden when this card has less inline space.</p>
        <button>I'm a button</button>
      </div>
    </div>
  </div>
</div>
              
            
!

CSS

              
                body {
  font-family: system-ui, serif;
  padding: 3rem;
}

.container {
  container-type: inline-size;
  width: 100%;
  max-width: 750px;
  margin: 0 auto;
}

// Base Styles
.visual {
  aspect-ratio: 1 / 1;
}

.desc {
  display: none;
}

.card {
  text-align: center;
  padding: 0.5rem;
}

// Responsive Styles

// 2-column grid layout at 350px or wider
@container (min-width: 350px) {
  .card {
    display: grid;
    grid-template-columns: 40% 1fr;
    align-items: center;
    gap: 1rem;
    text-align: left;
  }
}

@container (min-width: 500px) {
  .desc {
    display: block;
  }
}

// Parent grid
.parent-grid {
  display: grid;
  grid-gap: 1rem;
  grid-template-columns: 30% 1fr 20%;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
}
              
            
!

JS

              
                
              
            
!
999px

Console