locked
Subscript and Superscript in Dropdown List RRS feed

  • Question

  • User657329123 posted

    Hi there,

    I have a drop down list whose content is edited by user thorough a simple textbox. I have never seen a dropdown list with options having superscript or subscript.  As per my understanding, option element is a plain text and markup cannot be used.

    Any thoughts?

    Joe

    Monday, January 7, 2019 6:40 PM

Answers

  • User1520731567 posted

    Hi joegreen2005,

    Both <sub> and <sup> can not be nested inside <option>.

    There are some methods, but it seems that they are not be perfect.

    1.If you set the document encoding to UTF-8 or use unicode escapes you could use Unicode superscripts for this, e.g.:

    <option>25ᵗʰ</option>

    2.using Unicode superscript/subscript characters(Unicode Table),like:

    <select name=" ">
      <option value=" ">25&#x1D57;&#x02B0;</option>
    </select>

    3.Simulate styles with CSS:

    <style>
    select, option { 
      -webkit-font-feature-settings: "ordn";
      -moz-font-feature-settings: "ordn";
      font-feature-settings: "ordn";
      font-family: Calibri;
    }
    </style>

    More details,you could refer to:

    https://stackoverflow.com/questions/11790214/does-anyone-know-how-to-add-superscripts-in-the-option-tag-of-select

    Best Regards.

    Yuki Tao

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, January 8, 2019 6:11 AM