<main class="wrapper">
<section class="hero">
<h1>Cute Kitties</h1>
<article>
<h2>Natural beauty</h2>
</article>
</section>
<section class="kitties">
<ul>
<li>
<figure>
<img src="https://images.unsplash.com/photo-1496661269814-a841e78df103?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=400&fit=max&ixid=eyJhcHBfaWQiOjE0NTg5fQ" alt="Cute kitty Doll">
<figcaption>
<h3>Doll</h3>
</figcaption>
</figure>
</li>
<li>
<figure>
<img src="https://images.unsplash.com/photo-1469569946320-b4f13e4b7d5e?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=400&fit=max&ixid=eyJhcHBfaWQiOjE0NTg5fQ" alt="Cute kitty Jake">
<figcaption>
<h3>Jake</h3>
</figcaption>
</figure>
</li>
<li>
<figure>
<img src="https://images.unsplash.com/photo-1472491235688-bdc81a63246e?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=400&fit=max&ixid=eyJhcHBfaWQiOjE0NTg5fQ" alt="Cute kitty Silvester">
<figcaption>
<h3>Silvester</h3>
</figcaption>
</figure>
</li>
</ul>
</section>
</main>
<footer>
<p>I ❤ CSS Grid.</p>
</footer>
/* Typography imported from Google Fonts */
@import url('https://fonts.googleapis.com/css?family=Bangers&display=swap');
/* Generic styles */
h1, h2, h3 {
font-family: 'Bangers', cursive;
}
h1, h2 {
letter-spacing: 0.1em;
}
h3 {
letter-spacing: 0.2em;
}
/* hero image */
.hero {
background: url('https://images.unsplash.com/photo-1514511745018-1a24bf434b6c?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=400&fit=max&ixid=eyJhcHBfaWQiOjE0NTg5fQ') center;
background-size: cover;
padding: 4rem 2rem;
/* grid styles */
display: grid;
grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
align-items: center;
}
.hero > * {
color: white;
}
.hero > h1 {
font-size: 4rem;
padding-bottom: 1rem;
}
.kitties {
padding: 2rem;
}
.kitties > ul {
list-style-type: none;
/* Grid styles */
display: grid;
grid-template-columns: 320px 320px;
grid-template-rows: 1fr 1fr;
/* units for row and column gaps
only availablein px */
grid-column-gap: 16px;
grid-row-gap: 16px;
}
.kitties > ul > li {
border: 1px solid #ccc;
border-radius: .3rem;
}
.kitties > ul > li > figure {
max-height: 220px;
overflow: hidden;
border-top-left-radius: .3rem;
border-top-right-radius: .3rem;
position: relative;
}
.kitties > ul > li > figure > img {
width: 100%;
}
.kitties > ul > li > figure > figcaption {
position: absolute;
bottom: 0;
background-color: rgba(74, 4, 42, .7);
width: 100%;
}
.kitties > ul > li > figure > figcaption > h3 {
color: white;
padding: .75rem;
font-size: 1.25rem;
}
/* footer */
footer {
background-color: #4a042a;
padding: .75rem;
color: white;
text-align: center;
font-size: .75rem;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.