>

Articles → HTML → Subscript and superscript in HTML

Subscript and superscript in HTML






Syntax


<!--for super script-->
<sup>text</sup>
<!--for sub script-->
<sub>text</sub>



Example


<html>
	<head>
		<title>superscript and subscript demo</title>
	</head>
	<body>
		<!--for super script-->
    X
		<sup>2</sup> + Y 
		<sup>2</sup>
		<br />
		<!--for sub script-->
    H
		<sub>2</sub>O

	</body>
</html>


Picture showing the output of Subscript and superscript in HTML

Click to Enlarge


Browser support


Internet ExplorerFirefoxChromeSafariOperaEdge
YesYesYesYesYesYes



Posted By  -  Karan Gupta
 
Posted On  -  Thursday, October 13, 2016
 
Updated On  -  Friday, September 29, 2017

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250