JSFiddle - React, Tailwind, and code Playground
HTML
<div class="contact">
<form class="contact-form">
<div class="input label-name">
<input><span>Your name</span>
</div>
<div class="input label-email">
<input><span>Your e-mail</span>
</div>
</form>
</div>
CSS
.contact .contact-form {
margin: 0 auto;
margin-top: 8vh;
width: 70vw;
}
.contact .input {
display: inline-block;
position: relative;
border-bottom:1px solid red;
}
.contact .input input {
position: relative;
z-index: 1000;
background: none;
border: 0;
}
.contact .input span {
z-index: 500;
position: absolute;
top: 0;
left:0;
-webkit-transition: all 0.5s cubic-bezier(.25, .1, .25, 1);
-moz-transition: all 0.5s cubic-bezier(.25, .1, .25, 1);
-o-transition: all 0.5s cubic-bezier(.25, .1, .25, 1);
transition: all 0.5s cubic-bezier(.25, .1, .25, 1);
}
.contact input:focus ~ span{
top:-5vh;
}