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

              
                <h1>Subgrid Cards</h1>

<article class="card same">
  <header class="card-header">
    <h2>Article Title</h2>
  </header>
  <div class="card-body">
    <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Dolor itaque, vitae dicta autem sunt nesciunt atque nulla? Consectetur adipisci illum ipsa reprehenderit deleniti quia qui aliquid tempora ea accusamus. Quibusdam.</p>
  </div>
  <p class="byline">
    <span>
      by <a href="#">Mia</a>
    </span>
    <span>
      at <a href="#">Company</a>
    </span>
  </p>
  <button class="love">
    love it
  </button>
</article>

<article class="card same">
  <header class="card-header">
    <h2>Article Title</h2>
  </header>
  <div class="card-body">
    <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Dolor itaque, vitae dicta autem sunt nesciunt atque nulla? Consectetur adipisci illum ipsa reprehenderit deleniti quia qui aliquid tempora ea accusamus. Quibusdam.</p>
  </div>
  <p class="byline">
    <span>
      by <a href="#">Mia</a>
    </span>
    <span>
      at <a href="#">Company</a>
    </span>
  </p>
  <button class="love">
    love it
  </button>
</article>

<article class="card same">
  <header class="card-header">
    <h2>Article Title</h2>
  </header>
  <div class="card-body">
    <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Dolor itaque, vitae dicta autem sunt nesciunt atque nulla? Consectetur adipisci illum ipsa reprehenderit deleniti quia qui aliquid tempora ea accusamus. Quibusdam.</p>
  </div>
  <p class="byline">
    <span>
      by <a href="#">Mia</a>
    </span>
    <span>
      at <a href="#">Company</a>
    </span>
  </p>
  <button class="love">
    love it
  </button>
</article>

<article class="card same">
  <header class="card-header">
    <h2>Article Title</h2>
  </header>
  <div class="card-body">
    <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Dolor itaque, vitae dicta autem sunt nesciunt atque nulla? Consectetur adipisci illum ipsa reprehenderit deleniti quia qui aliquid tempora ea accusamus. Quibusdam.</p>
  </div>
  <p class="byline">
    <span>
      by <a href="#">Mia</a>
    </span>
    <span>
      at <a href="#">Company</a>
    </span>
  </p>
  <button class="love">
    love it
  </button>
</article>

<article class="card diff">
  <header class="card-header">
    <h2>What if We Have a Much Longer Article Title?</h2>
  </header>
  <div class="card-body">
    <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Ducimus eveniet, tempore error maxime praesentium eos, nam hic illo officiis id eius obcaecati fugiat perferendis culpa necessitatibus recusandae quod esse. Molestias.</p>
  </div>
  <p class="byline">
    <span>
      by <a href="#">Jen "Boss" Simmons</a>
    </span>
    <span>
      at <a href="#">Company</a>
    </span>
  </p>
  <button class="love">
    love it
  </button>
</article>

<article class="card diff">
  <header class="card-header">
    <h2>Article Titles Aren't Consistent</h2>
  </header>
  <div class="card-body">
    <p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Excepturi molestiae autem saepe libero assumenda dolorum quae laboriosam aliquam magni sint, voluptates officia dignissimos a incidunt, unde suscipit fugiat illum optio.</p>
  </div>
  <p class="byline">
    <span>
      by <a href="#">Deja "Empathic Dev" Hodge</a>
    </span>
    <span>
      at <a href="#">Company</a>
    </span>
  </p>
  <button class="love">
    love it
  </button>
</article>

<article class="card diff">
  <header class="card-header">
    <h2>This Article Title Will Need to be Fixed in Post-Production With a Much Shorter and Catchier Click-Bait Title</h2>
  </header>
  <div class="card-body">
    <p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Excepturi molestiae autem saepe libero assumenda dolorum quae laboriosam aliquam magni sint, voluptates officia dignissimos a incidunt, unde suscipit fugiat illum optio.</p>
  </div>
  <p class="byline">
    <span>
      by <a href="#">Ryanne "Fix It In Post" Hodson</a>
    </span>
    <span>
      at <a href="#">Company</a>
    </span>
  </p>
  <button class="love">
    love it
  </button>
</article>

<article class="card diff">
  <header class="card-header">
    <h2>Short Title</h2>
  </header>
  <div class="card-body">
    <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Placeat quae voluptatem repellat ad accusamus, ut nostrum saepe, cumque fuga excepturi facere modi, necessitatibus ipsam rem? Optio enim maxime repellat illo!</p>
  </div>
  <p class="byline">
    <span>
      by <a href="#">Jay "Do It" Dedman</a>
    </span>
    <span>
      at <a href="#">Company</a>
    </span>
  </p>
  <button class="love">
    love it
  </button>
</article>
              
            
!

CSS

              
                /* Grids */

body {
  display: grid;
  grid-template-columns: repeat(2, minmax(min-content, 24em));
  grid-gap: 1em;  
}

.card {
  display: grid;
  grid-template-columns: auto 1fr;
}

.card-header,
.card-body {
  grid-column-end: span 2;
}


/* Subgrid Rows */

.card {
/*   grid-row: span 3; */
/*   grid-template-rows: auto 1fr auto; */
/*   grid-template-rows: subgrid; */
/*   grid-row-gap: 0; */
}



/* Subgrid Columns */

body {
/*   grid-template-columns: repeat(2, auto 1fr); */
}

.card {
/*   grid-column: span 2; */
/*   grid-template-columns: subgrid; */
}





















/* Styles */
.same {
  display: none;
}

html {
  --font-scale: 0.25vmin;
}

body {
  --grad-fade: var(--dark-purple);
  background-image: linear-gradient(
    -15deg,
    var(--grad-fade),
    transparent 40%
  );
  align-content: center;
  justify-content: center;
  min-height: 100vh;
}

@media (prefers-color-scheme: dark) {
  body {
    --grad-fade: var(--dark-blue);
  }
}

h1 {
  grid-column: 1 / -1;
}

h1,
h2 {
  margin: 0;
}

p {
  font-size: 0.8em;
}

.card,
.card-body {
  border: 1px dotted var(--light-grey);
}

.card {
  background: var(--callout);
  border-radius: var(--radius);
}

.card-body {
  border-width: 1px 0;
}

.byline,
button {
  align-self: center;
  margin: 0;
}

.card-header {
  padding: 1em;
}

.card-body {
  padding: 0 1em;
}

.byline,
button {
  margin: 1em;
}

.byline {
  font-family: var(--zilla);
  font-style: italic;
}

.byline a {
  font-style: normal;
}

button {
  white-space: nowrap;
}

              
            
!

JS

              
                
              
            
!
999px

Console