Ahsan Tariq
Ahsan Tariq

Reputation: 76

Display 'rd' in superscript in html option tag

I want to show 3rd in my options tag, but the problem is 'rd' is not shown in super script.

eg,

<select>
<option>3<sup>rd</sup></option>
</select>

doesn't render 'rd' in super script and further more there is no Unicode available to represent 'r' and 'd' in super script.

Upvotes: 4

Views: 1349

Answers (2)

Alex
Alex

Reputation: 179

Be aware that there is a LOT of variation in the sizing of Unicode superscript characters. If you are rendering them in a small body font it may be acceptable. However, as the example below shows, I've found that if you need to show superscript characters at any reasonable scale, there's far to much variation for them to be usable.

An example rendering '43rd' using unicode characters for the 'r' and 'd'. The 'd' renders at twice the size of the 'r'.

I hate to say it, but I think the SUP tag remains the most reliable way to do this.

Upvotes: 0

chrona
chrona

Reputation: 1911

There are actually superscript chars for Unicode. https://en.wikipedia.org/wiki/Unicode_subscripts_and_superscripts#Other_superscript_and_subscript_characters

1ˢᵗ
2ⁿᵈ
3ʳᵈ
4ᵗʰ

Unfortunately, you can't use <sup> in <option> as it won't validate.

Upvotes: 3

Related Questions