How can I use a super-or-subscript tag in a HTML select option's display text?
Asked Answered
S

2

11

I have a dropdown field like this:

<select>
  <option>1</option>
  <option>2</option>
  <option>3</option> 
</select>

Can I use a superscript tag <sup> like this?

<select>
 <option><sup>1</sup></option>
 <option><sup>2</sup></option>
 <option><sup>2</sup></option> 
</select>
Strenta answered 22/7, 2015 at 4:20 Comment(0)
A
23

You can't use another tag inside options tag. But you can do something like:

<select>
 <option>&sup1;</option>
 <option>&sup2;</option>
 <option>&sup3;</option> 
</select>

This &sub1, &sub2, &sub3 is only possible for 1, 2 and 3.

You can write other numbers using codes from here: Superscript Chart

Or you can use this website to get the unicodes of alphabets: Unicode Character Search

Alpine answered 22/7, 2015 at 4:40 Comment(1)
You can use any Unicode character like this, which means you can use the full set of numeric superscript (and subscript) numbers: en.wikipedia.org/wiki/Unicode_subscripts_and_superscriptsSonnysonobuoy
G
0

Unicode superscript/subscript codes for numbers:

<p>Superscript numbers 0-9: &#x2070; &#185; &#178; &#179; &#x2074; &#x2075; &#x2076; &#x2077; &#x2078; &#x2079;</p>

<p>Subscript numbers 0-9: &#x2080; &#x2081; &#x2082; &#x2083; &#x2084; &#x2085; &#x2086; &#x2087; &#x2088; &#x2089;</p>

<select>
  <option>superscript &#x2070; &#185; &#178; &#179; &#x2074; &#x2075; &#x2076; &#x2077; &#x2078; &#x2079;</option>
  <option>subscript &#x2080; &#x2081; &#x2082; &#x2083; &#x2084; &#x2085; &#x2086; &#x2087; &#x2088; &#x2089;</option>
</select>
Gauger answered 8/9, 2022 at 4:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.