How to typeset units in HTML

What is the correct way to set type units in HTML? Stuff like


Do I just put the unit right after the value as above? Or is there a special short space? If so how do I prevent a line break between value and unit? How about combined units like


where A stands for Ampere and h for hours does anything special go between A & h?


There is a space between the value and the unit – I think a nbsp should do.
I’m not sure about the “Ah” case. It’s A times h, so it should be written with space “A h” (or with dot, “A·h”) according to the text below; but “Ah” feels ok to me. For combining a unit with a prefix, there is no space between them – it is “2 km” for metres with the prefix kilo.

One would ask scientists how to write physical units, of course. And scientists use TeX/LaTeX for this, so it’s a good idea to look there:

There is a TeX package describing how to render units in all detail.
LaTeX package “siu­nits” – In­ter­na­tional Sys­tem of Units.
See for example “2.4.1 Space between numerical value and unit symbol” on page 15.
It documents various special cases too, like that the temparature “10 °C” has a space, but the angle “10°” does not.

Source : Link , Question Author : Jens Schauder , Answer Author : Volker Siegel

Leave a Comment