How to move custom text cursor when typing in input box?
.cursor {
position: relative;
}
.cursor i {
position: absolute;
width: 10px;
height: 80%;
background-color: blue;
left: 5px;
top: 10%;
animation-name: blink;
animation-duration: 1s;
animation-iteration-count: infinite;
opacity: 1;
}
@keyframes blink {
from {
opacity: 1;
}
to {
opacity: 0.5;
}
}
<div class="cursor">
<input type="text" />
<i></i>
</div>
Although this successfully creates a blinking, rectangular, and blue text cursor, it remains in the same position once I type text into the input box. How can I modify the above code so that the cursor moves, similar to Mac/Linux terminals?