Is there a way to change the text-align property of an input field only after its width transition is complete? I've tried using a transition delay, but it didn't work. How can I achieve this effect?
div {
height: 3rem;
width: 100%;
background-color: skyblue;
position: relative;
}
input {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: right;
width: 10rem;
transition: width 300ms, text-align 0s 300ms;
}
input:hover {
width: 100%;
text-align: left;
transition: width 300ms;
}
<div>
<input type="text" placeholder="search">
</div>