Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use <sup></sup> in <option></option> in Html

I have code as this :

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

can i use like this ?

<select>
 <option><sup>1</sup></option>
 <option><sup>2</sup></option>
 <option><sup>2</sup></option> 
</select>
like image 569
Dam SamNang Avatar asked Jul 22 '15 04:07

Dam SamNang


People also ask

How do you do SUP in HTML?

The <sup> tag defines superscript text. Superscript text appears half a character above the normal line, and is sometimes rendered in a smaller font. Superscript text can be used for footnotes, like WWW. Tip: Use the <sub> tag to define subscript text.

Can you put HTML in an option tag?

No, you can't do this. <option> tags cannot contain any other tags. In Chrome at least, <option> tags can contain <script> tags.

What is the use of sub and sup tag with suitable example?

Subscript text can be used for chemical formulas, like H2O to be written as H2O. Superscript: The <sup> tag is used to add a superscript text to the HTML document. The <sup> tag defines the superscript text. Superscript text appears half a character above the normal line and is sometimes rendered in a smaller font.

Can we give ID to option tag?

An id on an <option> tag assigns an identifier to the element. The identifier must be unique across the page.


1 Answers

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

like image 113
Gurjot Bhatti Avatar answered Oct 27 '22 06:10

Gurjot Bhatti