Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I use ² or <sup>2</sup>

Tags:

html

In consideration of machine based readability (but not exclusively, please advice where relevant), is it better to use

square²

or

square<sup>2</sup>

in my HTML file (using utf-8 encoding)?

like image 204
Gottlieb Notschnabel Avatar asked Jul 01 '14 22:07

Gottlieb Notschnabel


2 Answers

I suggest to use <sup> tag in html context.

Full official answer can be found here: Superscripts and Subscripts

First reason:

When used in mathematical context (MathML) it is recommended to consistently use style markup for superscripts and subscripts. This is because mathematical layout allows not just individual symbols, but entire expressions to be superscripted or subscripted in a regular, nested manner.

Second reason:

However, when super and sub-scripts are to reflect semantic distinctions, it is easier to work with these meanings encoded in text rather than markup, for example, in phonetic or phonemic transcription. Otherwise, they would require markup in the middle of words, and they may also be inadvertently changed to normal style text, when exporting to plain text. This applies to the majority of super and subscripted characters in Unicode. On the other hand, some user agent may support certain superscripted or subscripted characters only when used as marked up text for example, because of lack of font support for them.

like image 185
Iłya Bursov Avatar answered Nov 15 '22 11:11

Iłya Bursov


I prefer to use the UTF-8 symbol, because the <sup> tag actually changes the line height slightly, a very annoying undesirable side effect.

like image 43
Maksym Shcherban Avatar answered Nov 15 '22 13:11

Maksym Shcherban