JSFiddle - React, Tailwind, and code Playground
HTML
<div id="big_container">
<div>
<div class="little_container">
<figure>
<img src="http://placekitten.com/500/440" />
<figcaption>have a kitty!!1</figcaption>
</figure>
</div>
<div class="little_container">
<figure>
<img src="http://placekitten.com/450/400" />
<figcaption>moar kitty!</figcaption>
</figure>
</div>
<div class="little_container">
<figure>
<img src="http://placekitten.com/300/440" />
<figcaption>too many kitty..</figcaption>
</figure>
</div>
</div>
</div>
CSS
#big_container {
display: block;
position: relative;
width: 100%;
padding-bottom: 40%;
white-space: nowrap;
overflow-x: scroll;
overflow-y: hidden;
}
#big_container>div {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
.little_container {
display: inline-block;
height: 100%;
width: 100%;
text-align: center;
}
#big_container figure {
display: block;
height: 100%;
margin: 0;
}
/*
set `border` to `45px` as background for `figacption`
set `border-left`, `border-right`, `border-top` to `0px`
*/
img {
max-height: calc(100% - 40px);
border: 45px solid #ddd;
border-left: 0px;
border-right: 0px;
border-top: 0px;
}
/*
set `figcaption` elements
set `top` to `-50px` to center `content`
in vertical middle of `border`,
set `width` to `calc(100% / 3)` : number of `figure` elements
set `left` to `calc(100% / 3)` : position `content` at
horizontal center of `:after` , `border`
*/
figcaption {
top: -50px;
display: block;
position: relative;
background-color: transparent;
padding: 10px;
line-height: 20px;
box-sizing: border-box;
width: calc(100% / 3);
left: calc(100% / 3);
}