<div class="card">
<div class="card__tag">Must Try</div>
<div class="card__content">
<h2>Card Title</h2>
<p>Some des will go here and I need it to wrap into lines</p>
</div>
<div class="card__thumb">
<img src="https://picsum.photos/966/358?random=1" width="966" height="358" alt="" />
</div>
</div>
@import url("https://fonts.googleapis.com/css2?family=Exo:wght@600&display=swap");
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
width: 100vw;
min-height: 100vh;
font-family: "Exo", Arial, sans-serif;
background-color: #557;
padding: 20px;
display: grid;
place-content: center;
gap: 20px;
}
img {
max-width: 100%;
height: auto;
vertical-align: middle;
border-radius: 5px;
object-fit: cover;
object-position: center;
}
.card {
color: #fff;
text-shadow: 0 2px 3px rgba(0, 0, 0, 0.3);
max-width: 60vw;
background-color: #fff;
border-radius: 5px;
border: 1px solid #e8e0e0;
box-shadow: 0 3px 10px 0 rgb(0 0 0 / 0.3);
padding: 5px;
}
.card__tag {
background-color: #2196f3;
padding: 0.75rem 1.75rem 0.75rem 1rem;
border-radius: 0 10rem 10rem 0;
}
.card__content {
background-image: linear-gradient(
to top,
hsla(0, 0%, 0%, 0.62) 0%,
hsla(0, 0%, 0%, 0.614) 7.5%,
hsla(0, 0%, 0%, 0.596) 13.5%,
hsla(0, 0%, 0%, 0.569) 18.2%,
hsla(0, 0%, 0%, 0.533) 22%,
hsla(0, 0%, 0%, 0.49) 25.3%,
hsla(0, 0%, 0%, 0.441) 28.3%,
hsla(0, 0%, 0%, 0.388) 31.4%,
hsla(0, 0%, 0%, 0.333) 35%,
hsla(0, 0%, 0%, 0.277) 39.3%,
hsla(0, 0%, 0%, 0.221) 44.7%,
hsla(0, 0%, 0%, 0.167) 51.6%,
hsla(0, 0%, 0%, 0.117) 60.2%,
hsla(0, 0%, 0%, 0.071) 70.9%,
hsla(0, 0%, 0%, 0.032) 84.1%,
hsla(0, 0%, 0%, 0) 100%
);
}
.card__thumb {
border-radius: 5px;
overflow: hidden;
}
.card {
display: grid;
}
.card > * {
grid-area: 1 / -1;
}
.card__tag {
z-index: 3;
align-self: start;
justify-self: start;
margin-top: 2rem;
}
.card__content {
z-index: 2;
display: flex;
flex-direction: column;
justify-content: flex-end;
padding: 1rem;
}
.card__thumb {
z-index: 1;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.