I’m trying to align the text and the icon to be vertically aligned in my navbar. I made the icons inline with the text, but any padding that I give to it to separate the icon and text afterwards results in the icon disappearing.
I tried different display properties but it doesn’t seem to mesh well. The only thing that worked for was hardcoding icons which isn’t really fixing the problem.
2
Answers
You can add
flex, items-center, gap-[specify the gap here]
classes to theli
tag.That’s will add the following properties to the
li
:That should work properly.
You need to use flex inside the list item, and wrap the text with span so it can be aligned the icon; without wrapping it, it will be aligned with beginning of line.
So you need it like this: