How to make subscript and superscript programs

 You may still remember the exact science lesson formulas at school such as Chemistry, Mathematics or Physics. How would you study the chemical formula for water H2O, the quadratic equation ax2 + bx + c = 0, or Albert Einstein's energy formula E = mc2. Of course, this article does not discuss the formula, but rather the writing of the formula. If you pay attention, there is text that is smaller and located below or above the normal line.


Small text that is located below or above the normal line is called subscript and superscript. Word processor applications such as Microsoft Word have this feature and are very easy to use. Then, what if you want to create an online article and need to format the text into subscript or superscript. You can use two ways, namely with HTML elements or tags or CSS properties.


This article is about creating subscript or superscript text with HTML. HTML has a sub element (<sub> tag) to create subscript text and a sup element (<sub> tag) to create superscript text. The text to be subscripted or superscripted is placed between the opening tag and closing tag. The following is to create a subscript or superscript text with HTML.

The following html code:

<!DOCTYPE html>
<html>
<body>

<h2>Membuat teks subscript dan Superscript</h2>
<p>Membuat teks subscript dan superscript dengan elemen <strong>sub</strong> dan elemen <strong>sup</strong> HTML.</p>

<h3>Membuat teks subscript.</h3>
<p>Rumus kimia air : H<sub>2</sub>O</p>
<p>Rumus kimia karbon dioksida : CO<sub>2</sub></p>

<h3>Membuat teks superscript.</h3>
<p>Rumus persamaan kuadrat : ax<sup>2</sup> + bx + c = 0</p>
<p>Rumus energi Albert Einstein : E = mc<sup>2</sup></p>

</body>
</html>
SHARE
  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment