Thumbnail for var, sub and sup episode.
3 minutes

Unveiling the Forgotten Trio: <var>, <sub>, and <sup> - HTML’s Unsung Heroes! 🦸‍♂️

Greetings, fellow web adventurers! Today, let’s embark on a journey to rediscover the forgotten trio of HTML tags - <var>, <sub>, and <sup>. Often overshadowed by their flashy companions, these humble tags play crucial roles in the web symphony. Get ready to add a touch of flair and functionality to your content as we dive into the world of variables, subscripts, and superscripts!

<var> - Elevating Variables to Stardom 🌟

Ever wished to give your variables the recognition they deserve? Enter <var> - the tag designed to make your variables stand out! Whether it’s mathematical expressions or programming code, <var> gives your variables a spotlight moment.

<p>
  The formula for the area of a circle is <var>π * r<sup>2</sup></var
  >, where <var>r</var> is the radius.
</p>

In this example, <var> gracefully wraps around our variable r, making it clear and distinguished. It’s like giving your variables a VIP pass to the prominence they merit.

Mix of var and sup

Dive into the world beneath the baseline with <sub>. This tag is your trusty submarine, taking content down a level. Perfect for chemical formulas, footnotes, or anything that needs a subtle descent.

<p>
  H<sub>2</sub>O is the chemical formula for water. It consists of two hydrogen
  atoms and one oxygen atom.
</p>

In this snippet, <sub> gracefully tucks the numbers beneath the text baseline, just like they should be. Say goodbye to awkwardly floating subscripts!

Sub tag

<sup> - Elevating Content with Superscripts 🚀

Ready to lift your content to new heights? Enter <sup>, the tag that elevates text above the baseline. Ideal for exponents, ordinal numbers, or any content that deserves a rise.

<p>The 5<sup>th</sup> element on the periodic table is Boron (B).</p>

Here, <sup> raises the ordinal indicator “th” to its rightful position. It’s like giving your content a boost, making it visually appealing and easy to understand.

Sup tag

Putting It All Together - A Harmonious Example 🎶

Let’s combine these tags to create a harmonious piece of content:

<p>
  Let’s solve the equation <var>x<sup>2</sup> + 2x + 1 = 0</var> to find the
  roots. The discriminant (Δ) is given by the formula Δ =
  <var>b<sup>2</sup> - 4ac</var>.
</p>

In this example, we’ve used <var> for variables, <sup> for exponents, and regular text for the narrative. It’s a symphony of clarity and style!

Mix it all

Why Use Them? - The Practical Magic 🎩✨

  • Accessibility: These tags enhance the accessibility of your content, making it more understandable for users and assistive technologies.
  • Visual Hierarchy: They help establish a visual hierarchy, guiding readers to understand the structure and importance of different elements.
  • Mathematical Notation: Ideal for displaying mathematical equations, chemical formulas, and anything that involves subscript and superscript formatting.

The trio of <var>, <sub>, and <sup> may be the unsung heroes of HTML, but their contributions are immeasurable. By incorporating these tags into your content, you not only enhance its visual appeal but also add layers of meaning and clarity. So, the next time you’re crafting content with mathematical flair or diving into the intricacies of subscript and superscript, let these tags take center stage. After all, every hero deserves their moment in the spotlight! 🎬🌟

Photo of Roman Mager on Unsplash