Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Certain characters cause buttons to display incorrectly in html specifically √

Tags:

html

css

I am working on an emoji panel and and I am having an issue where specific characters cause a button to display differently and I do not know the reason here is the code that shows the issue.

button {
    width: 50px;
    height: 50px;
}
<span>
    <button>😁</button>
    <button>√</button>
    <button>🔴</button>
    <button>√</button>
    <button>👑</button> 
</span>

The code causes the buttons that have the square root symbol to display a few pixels lower and I do not know why this is happening so I was wondering why. I have looked around to figure out the solution but I have not seen this specific issue so it is hopefully something simple that I am overlooking but I have been unable to figure it out.


This is an image showing what the buttons look like.
This is an image showing what the buttons look like.

like image 565
Eli Avatar asked Nov 16 '25 19:11

Eli


1 Answers

This is caused by the icons not having the same height.

Consider adding a line-height to the <button> to align them:

button {
    width: 50px;
    height: 50px;
    line-height: 50px;
}
<span>
    <button>😁</button>
    <button>√</button>
    <button>🔴</button>
    <button>√</button>
    <button>👑</button> 
</span>
like image 100
0stone0 Avatar answered Nov 19 '25 10:11

0stone0



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!