JSFiddle - React, Tailwind, and code Playground

HTML

<div class='item'>
</div>
<div class='item'>
</div>

CSS

.item {
	position:relative;
	background:red;
  animation:float 3s infinite ease-in-out ;
  width:100px;
  height:100px;
}

.item:nth-of-type(1) {
  top: 100px;
}

.item:nth-of-type(2) {
  top: 300px;
}

@keyframes float {
    from, to { transform: translateY(-10px); }
    50% { transform: translateY(10px); }
}