<article class="card">
<div class="card__content">
<div class="card__image-container">
<img class="card__image" src="https://picsum.photos/200/200" alt=""/>
</div>
<div class="card__body">
<div class="card__body-content">
<h3 class="card__heading">Title of this block</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam convallis enim ex, vitae venenatis orci tincidunt id. Curabitur at velit orci. Donec consequat volutpat nunc vitae vestibulum.</p>
</div>
</div>
</div>
</article>
.card {
container: card / size;
height: 450px;
}
.card__content {
display: grid;
grid-template-columns: 1fr 2fr;
height: 100%;
}
.card__body {
font-size: clamp(1rem, 3cqi, 1.2rem);
}
.card__heading {
font-size: clamp(1.5rem, 7cqi, 4rem);
}
@container (aspect-ratio < 4/3) {
.card__content {
display: flex;
flex-direction: column;
}
.card__body {
place-items: flex-start;
padding: 1rem 1.5rem;
}
.card__image {
aspect-ratio: 16 / 9;
max-height: 200px;
}
}
@layer base {
body {
font-family: system-ui;
display: grid;
place-items: center;
height: 100vh;
}
.card {
background: #f8f7f1;
max-width: 850px;
width: 450px;
overflow: auto;
resize: horizontal;
}
.card__body {
display: grid;
place-items: center;
padding: 1rem 1.5rem;
}
.card__heading {
margin: 0 0 2cqi;
}
.card__image {
width: 100%;
height: 100%;
aspect-ratio: 9/16;
object-fit: cover;
object-position: center;
}
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.