Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React icon does not align with text

Tags:

css

reactjs

I have a very simple question, I have react icon and text in front of it. The text is not aligned with the React Icon. How can I align it with text? Check the screenshot. My code is:

<MdPerson size={20}/><span> Profile</span>

screenshot

like image 775
Bangash Avatar asked Dec 14 '22 20:12

Bangash


1 Answers

Try to wrap icon component and your span label with outer div block. Then apply some class to the div where child elements aligned by flexbox.

.centered-label {
  display: flex;
  align-items: center;
}
like image 176
Andrii Skrebets Avatar answered Jan 03 '23 17:01

Andrii Skrebets