Label is covering my input. After I click input I still want to see label with Dupsko
content, but over my input.
div {
position: relative;
background-color: rgba(38, 50, 56, 0.31);
transition: all 250ms cubic-bezier(0.35, 0, 0.25, 1);
}
label {
padding-left: 8px;
position: absolute;
text-overflow: ellipsis;
overflow: hidden;
cursor: text;
z-index: -10;
}
input {
outline: none;
border: none;
background-image: none;
background-color: transparent;
width: 100%;
padding: 8px;
border-bottom: 1px solid #263238;;
transition: all 250ms cubic-bezier(0.35, 0, 0.25, 1);
}
input:focus {
background-color: #263238;
border-bottom: 2px solid #3FBA84;
color: #FFFFFF;
}
input:focus ~ label {
position: unset;
color: #3FBA84;
}
<div>
<label>Dupsko</label>
<input>
</div>
How can I apply styles to this label only if input is focused ?