If you want to quote a value and a plus/minus uncertainty range in HTML, using the <sup>
and <sub>
tags leaves the values offset, e.g.:
2.3<sup>+1.2</sup><sub>-0.5</sub>
gives:
2.3+1.2-0.5
If the webpage supports MathJAX (or something similar), then you could, of course, use LaTeX syntax, e.g.,
$2.3^{+1.2}_{-0.5}$
to give:
However, if you just want to use HTML (and don't want/can't use a style sheet), then (heavily based on this SO answer), you could do:
<span style="white-space:nowrap;">
2.3<span style="display:inline-block;vertical-align:-0.4em;margin-left:0.1em;line-height:1.15em;font-size:70%;text-align:left;">+1.2<br/>−0.5</span>
</span>
Unfortunately, the style
attribute gets sanitised by the Markdown renderer used to GitHub, but an image of it looks like: