JSFiddle - React, Tailwind, and code Playground
HTML
<div>
<figure>
<img />
<figcaption>This is some text. This is some text. This is some text. This is some text. This is some text.</figcaption>
</figure>
</div>
CSS
div {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
overflow-x: hidden;
overflow-y: auto;
display: flex;
align-items: center;
justify-content: center;
}
figure {
position: relative;
max-width: 85%;
margin: auto;
display: block;
}
img {
width: 300px;
height: 150px;
background: #000;
}
figcaption {
display: table-caption;
caption-side: bottom;
width: 100%;
}