How to write Mathematical and Chemical Equation in HTML

To write Mathematical and Chemical Equation in HTML, we used

Superscript and Subscript

HTML provide specific tags for writing superscripts and subscripts, allowing you format text. The <sup> tag is used for superscripts and <sub> tag is used for subscripts.
By using these text you ensure that rendering of superscripted and subscripted content

Example 1:
To display "x2" ( x squared ) as superscript, you can use following HTML
HTML :
<p>x<sup>2</sup></p>


Example 2:

To display "H2O" ( water molecules ) with the  "2" as a subscript, you can use following HTML

HTML :
<p>H<sub>2</sub>O</p>


There are several another methods are also used to write mathematical an chemical equation such as MathML Approach and superscript and subscript.


Comments