Это просто с некоторыми Javascript и незначительными изменениями в стилях.Попробуйте это.
$(document).ready(function () {
$('.-textbox').click(function (){
$(this).siblings('span').addClass('active');
});
$('.-textbox').blur(function(){
if($('.-textbox').val()=== ''){
$(this).siblings('span').removeClass('active');
}
});
});
.-input-container {
max-width: 540px;
padding-bottom: 30px;
margin-top: 30px;
position: relative;
}
input.-textbox {
width: 100%;
border-radius: 40px;
background-color: #f5f5f5;
border: 1px solid #dddddd;
padding: 16px 30px;
font-size: 16px;
color: #555555;
font-family: OpenSans;
font-weight: normal;
font-style: normal;
font-stretch: normal;
line-height: 1.88;
letter-spacing: normal;
text-align: left;
&:focus{
outline: none;
box-shadow: none
}
}
input.-textbox ~ .floating-label {
position: absolute;
pointer-events: none;
left: 45px;
top: 18px;
transition: 0.2s ease all;
}
input.-textbox ~ .floating-label.active{
top: 8px;
bottom: 10px;
left: 45px;
font-size: 10px;
opacity: 1;
line-height: 2.1;
font-family: OpenSans;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="-input-container col-xl-6 col-lg-6 col-md-12 col-sm-12 col-12 ">
<input type="email" class="-textbox form-control" required="">
<span class="floating-label">E-postadress</span>
</div>