.email-input-container>span{
background-color: red;
position: absolute;
left: 10px;
transform: translateY(-20px);
opacity: 0;
transition: all 0.3s ease;
}
input:focus + span{
opacity: 1;
}
Link to complete code here:
.email-input-container>span{
background-color: red;
position: absolute;
left: 10px;
transform: translateY(-20px);
opacity: 0;
transition: all 0.3s ease;
}
input:focus + span{
opacity: 1;
}
Link to complete code here:
Place your <span>
after the <input>
field.
Do:
<div class="email-input-container">
<input type="email" placeholder="Email">
<span>Email</span>
</div>
Instead of:
<div class="email-input-container">
<span>Email</span>
<input type="email" placeholder="Email">
</div>
Hope this helps!
you have given your span opacity: 0
, so it doesn't shows up.
the + selector applies to elements after the called element. see here:
you specified +
which mean input and then span like this
<div class="email-input-container">
<input type="email" placeholder="Email">
<span>Email</span>
</div>