Search code examples
htmlunicodehtml-selectsubscriptsuperscript

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


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>

Solution

  • 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