Post Card Grid
The Post Card Grid lays posts out as cards of equal width. You give it the cards; the grid shares the width between them, wraps to a new row when they run out of room, and keeps their titles and excerpts level across a row.
What it is for
Use the grid wherever a page lists more than one post: a blog index, a category page, a row of related reading under an article. The grid holds the cards; a card holds one post.
The card is its own module, with its own demo page. Here we look at the grid around it: how many cards it puts in a row, how much space it leaves between them, and how wide it grows.
The source
A grid holds one card per post. This is the grid with a single card inside it; the words in capitals are the placeholders you replace with the post's own image, category, title and excerpt. Copy the card once per post:
<div class="module-post-card-grid">
<div class="module-post-card">
<a class="module-post-card-article-featured-image" href="POST-URL">
<img src="IMAGE-URL" alt="IMAGE-DESCRIPTION" width="WIDTH" height="HEIGHT">
</a>
<span class="module-post-card-categoryplate-frame"><span class="module-post-card-categoryplate"><a class="module-post-card-article-category" href="CATEGORY-URL">CATEGORY</a></span></span>
<div class="module-post-card-title-frame">
<h3 class="module-post-card-article-title"><a href="POST-URL">TITLE</a></h3>
</div>
<div class="module-post-card-excerpt-frame">
<p class="module-post-card-article-excerpt">EXCERPT</p>
</div>
</div>
<!-- one more module-post-card per post -->
</div>
How many cards per row
You set the number of cards in a row with a second class next to
"module-post-card-grid". Leave it off and you get four cards per
row, the default. Add a class from "--2" to "--6"
for that many:
"module-post-card-grid--2"puts two cards in a row, the widest the cards get."module-post-card-grid--3"puts three in a row."module-post-card-grid--4"puts four in a row. Same as the default."module-post-card-grid--5"puts five in a row."module-post-card-grid--6"puts six in a row, the narrowest the cards get.
Each setting brings its own spacing: two large cards get more space around them than six small ones. You never set that space yourself. The rest of this page shows each setting in turn, starting with the widest cards.