JSFiddle - React, Tailwind, and code Playground
HTML
<div class="parent">
<div class="parent__child"><p>1</p></div>
<div class="parent__child"><p>2</p></div>
<div class="parent__child"><p>3</p></div>
<div class="parent__child"><p>4</p></div>
<div class="parent__child"><p>5</p></div>
</div>
CSS
* {
margin: 0;
padding: 0;
border: 0;
font-size: 0;
}
.parent {
padding: 10px;
position: absolute;
top: 50%;
left: 50%;
margin-top: -100px;
margin-left: -500px;
display: inline-flex;
justify-content: flex-start;
flex-direction: row;
width: 1000px;
min-height: 200px;
background: rgba(40, 40, 20, .2);
animation-name: flex-anim;
animation-timing-function: ease-in-out;
animation-iteration-count: infinite;
animation-duration: 5s;
}
@keyframes flex-anim {
0% {justify-content: flex-start;}
20% {justify-content: flex-end;}
40% {justify-content: center;}
60% {justify-content: space-between;}
80% {justify-content: space-around;}
100% {width: 800px; margin-left: -400px;}
}
.parent__child {
width: 110px;
height: 200px;
background: red;
box-sizing: border-box;
}
.parent__child:nth-child(1),
.parent__child:nth-child(2),
.parent__child:nth-child(3),
.parent__child:nth-child(4),
.parent__child:nth-child(5) {
border-right: 1px solid #1b1b1b;
}
p {
font-size: 150px;
color: #1b1b1b;
text-align: center;
line-height: 194px;
}