5 ms·
<sup> and <sub> has the problem that they change the line height. So if you have an paragraph and one line contains "Nice ground with 42 m² grass" then that li
by silvestrov 4y ago
<sup> and <sub> has the problem that they change the line height. So if you have an paragraph and one line contains "Nice ground with 42 m² grass" then that line is taller than all the other lines, which makes it rather ugly.
So I automatically converts all m<sup>2</sup> and similar into the unicode symbols: https://en.wikipedia.org/wiki/Unicode_subscripts_and_superscripts#Superscripts_and_subscripts_block https://en.wikipedia.org/wiki/Unicode_subscripts_and_supersc...
- derefr 4y ago> So I automatically converts all m<sup>2</sup> and similar into the unicode symbols Nice in theory, but only works for trivial cases. Most old-school use of <sup> is as a quick-and-dirty pre-MathML way of rendering equations as (accessible) text in browsers. (The people who didn't care about accessibility rendered TeX to an image and embedded it.)
- flanbiscuit 4y ago> <sup> and <sub> has the problem that they change the line height. So if you have an paragraph and one line contains "Nice ground with 42 m² grass" then that line is taller than all the other lines, which makes it rather ugly. normalize.css fixed this problem by setting the line-height to 0 and using position relative. https://github.com/necolas/normalize.css/blob/master/normalize.css#L125 https://github.com/necolas/normalize.css/blob/master/normali...
- WorldMaker 4y agoThough it useful to point out that the Unicode superscripts and subscripts were also originally intended to be ascenders/descenders (which in the strictest sense would also affect line height) are as represented in most fonts instead as roughly "numerator/denominator" numbers instead of "proper" superscripts and subscripts. The W3C recommends to prefer the markup versions, and various years the Unicode committee has also suggested not to use the Unicode versions except in backwards compatibility with old ISO codes and in certain semantically more meaningful situations as "single words" (chemistry formulas more so than math, for instance). Though the Unicode recommendations have waffled back and forth over the years. Both have recommended it in part because of metadata available to screen-readers for accessibility. Not that you always have to follow such recommendations from groups such as these, just that it is useful to know what the recommendations are. Also as others pointed out, some CSS stylesheets are better than others at line-height of sub/sup markup and while the default styles are kind of awful, it is useful to know there are CSS options. https://en.wikipedia.org/wiki/Unicode_subscripts_and_superscripts https://en.wikipedia.org/wiki/Unicode_subscripts_and_supersc...
- chrismorgan 4y ago> represented in most fonts instead as roughly "numerator/denominator" numbers instead of "proper" superscripts and subscripts My experience is that superscripts/subscripts are normally on a different line to numerators/denominators. A couple of very simple examples to test this: ¹½₂ ({superscript one}{vulgar fraction one half}{subscript two}), ²2⁄1₁ ({superscript two}{digit two}{fraction slash}{digit one}{subscript one}).
- WorldMaker 4y agoHN's font choice of Verdana, at least on Windows, shows all of those numbers lining up in your sample. The only noticeable difference is that the "1" in the "vulgar fraction one half" in this font has dropped the bottom "base" serif of the one.