<div class="center">
<div class="article-card">
<div class="content">
<p class="date">Jan 1, 2022</p>
<p class="title">Article Title Goes Here</p>
</div>
<img src="https://images.unsplash.com/photo-1482877346909-048fb6477632?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=958&q=80" alt="article-cover" />
</div>
</div>
body {
padding: 0px;
margin: 0px;
}
.center {
display: flex;
height: 100vh;
align-items: center;
justify-content: center;
}
.article-card {
width: 350px;
height: 220px;
border-radius: 12px;
overflow: hidden;
position: relative;
font-family: Arial, Helvetica, sans-serif;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
transition: all 300ms;
}
.article-card:hover {
transform: translateY(-2px);
box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22);
}
.article-card img {
width: 100%;
height: 100%;
object-fit: cover;
}
.article-card .content {
box-sizing: border-box;
width: 100%;
position: absolute;
padding: 30px 20px 20px 20px;
height: auto;
bottom: 0;
background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
}
.article-card .date,
.article-card .title {
margin: 0;
}
.article-card .date {
font-size: 12px;
color: rgba(255, 255, 255, 0.9);
margin-bottom: 4px;
}
.article-card .title {
font-size: 17px;
color: #fff;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.