Mr.T.K Mr.T.K - 1 year ago 86
HTML Question

How many px occupy the single  ?

I just want to know the how many "px" occupy the single "&nbsp". so that i can calculate and give the padding instead of &nbsp

Answer Source

It's not possible to know this accurately, because it will depend on the font's metrics and the way it's rendered. A non-breaking space is usually rendered with the same width as a regular space in the same font, it just suggests to the browser not to wrap at that point or collapse the space.

You should never rely on fonts rendering a particular way in order to line up design elements on the page. Specify distances in units that are appropriate, and don't use non-breaking spaces in situations for which they aren't suitable.

You could start with a value of, say, around 0.4em. But if you absolutely have to exactly match the width of a non-breaking space, you are using a non-breaking space incorrectly.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download