<div class="cards">
<div class="card">
<div class="image">
<img src="https://assets.codepen.io/43365/bulldog.jpeg" />
</div>
<div class="content">
<h2>Sleepiest Doggo!</h2>
<p>Look at this sleepiest pupper!</p>
</div>
</div>
<div class="card is-loading">
<div class="image"></div>
<div class="content">
<h2></h2>
<p></p>
</div>
</div>
</div>
body {
display: flex;
align-items: center;
justify-content: center;
background: #ddd;
min-height: 100vh;
padding: 30px;
}
.cards {
display: flex;
}
.card {
margin: 10px;
width: 300px;
background: #fff;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
.image {
img {
max-width: 100%;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
}
}
.content {
padding: 20px 30px;
}
}
.card.is-loading {
.image,
h2,
p {
background: #eee;
background: linear-gradient(110deg, #ececec 8%, #f5f5f5 18%, #ececec 33%);
border-radius: 5px;
background-size: 200% 100%;
animation: 1.5s shine linear infinite;
}
.image {
height: 200px;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
h2 {
height: 30px;
}
p {
height: 70px;
}
}
@keyframes shine {
to {
background-position-x: -200%;
}
}
View Compiled
// Made w/ ❤️ by Better Dev
// Twitter: twitter.com/chris__sev
// YouTube: https://www.youtube.com/channel/UCmXVXfidLZQkppLPaATcHag
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.