'How can I vertically center an icon in an input?

I don't know how to center an icon vertically inside an input. This is my code:

<i-feather name="user" class="fea icon-sm icons"></i-feather>
<input type="text" class="form-control ps-5" placeholder="Name" name="s" required="">

Currently it looks like this:

HTML input with icon slightly below vertical center

and I want to achieve an effect like this:

HTML input with icon centered vertically

How do I center the icon vertically in the input?



Solution 1:[1]

There are two styling options you can use. These are block and flex. Block will not be responsive while flex will be responsive. I hope this solve your issue.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1