JSFiddle - React, Tailwind, and code Playground
HTML
<div class="search-wrapper">
<input type="text" v-model="keyword" placeholder="Search Title..."/>
<label>Search Title</label>
</div>
CSS
label {
position: absolute;
font-size: 12px;
color: rgba(0,0,0,.50);
top: 8px;
right: 12px;
z-index: -1;
transition: .15s all ease-in-out;
}
input {
padding: 4px 12px;
color: rgba(0,0,0,.70);
border: 1px solid rgba(0,0,0,.12);
transition: .15s all ease-in-out;
background: white;
&:focus {
outline: none;
transform: scale(1.05);
& + label {
font-size: 10px;
transform: translateY(-24px) translateX(-12px);
}
}
&::-webkit-input-placeholder {
font-size: 12px;
color: rgba(0,0,0,.50);
font-weight: 100;
}