A subscript is also used in chemistry to indicate the number of atoms of an element in a molecule. To create a subscript, use the <sub> tag. A superscript is frequently used in mathematics to indicate and exponent. To create a superscript, use the <sup> tag.
Welcome to Bucaro TecHelp!

Welcome to Bucaro TecHelp!
Maintain Your Computer and Use it More Effectively
to Design a Web Site and Make Money on the Web

About Bucaro TecHelp About BTH User Agreement User Agreement Privacy Policy Privacy Site Map Site Map Contact Bucaro TecHelp Contact Advertise on Bucaro TecHelp Advertise Here RSS News Feeds News Feeds

HTML5 Solutions: Essential Techniques for HTML5 Developers

Essential Techniques for HTML5 Developers

HTML5 brings the biggest changes to HTML in years. Web designers now have new techniques, from displaying video and audio natively in HTML, to creating realtime graphics on a web page without a plugin.

This book provides a collection of solutions to all of the most common HTML5 problems. Every solution contains sample code that is production-ready and can be applied to any project.

Click Here

Creating a Subscript or Superscript with HTML

A subscript is a number, letter, or symbol written directly next to and slightly below a word or phrase that can be used to reference the word or phrase to a footnote. A subscript is also used in chemistry to indicate the number of atoms of an element in a molecule. To create a subscript, use the <sub></sub> tag, as shown below.

The chemical formula for water is H2O, and the formula for Hydrogen Peroxide is H2O2.

<p>The chemical formula for water is H<sub>2</sub>O, and the formula
for Hydrogen Peroxide is H<sub>2</sub>O<sub>2</sub>.</p>

If you want to use a subscript reference a footnote, note that the <sub> tag responds to the onclick event. This means, you can use Java Script with the document's location object, to set it up so the user can click on the subscript and be taken to the footnote, as shown below.

Click on the number1 to be taken to the footnote

<p>Click on the number<sub style="color:blue;" onclick="javascript:location='#footnote1';">1</sub> to be taken to the footnote</p>

Example code for a footnote is shown below.

<p><a name="footnote1"><sup>1</sup></a> This is the footnote text</p>

A superscript is a number, letter, or symbol written directly next to and slightly above a a number, letter, or symbol. A superscript is frequently used in mathematics to indicate and exponent. To create a superscript, use the <sup></sup> tag, as shown below.

Mass and energy are related as defined by Einstein's formula E=mC2, where energy (E) is equal to the mass (m) multiplied by the speed of light (C) squared.

<p>Mass and energy are related as defined by Einstein's formula E=mC<sup>2</sup>,
where energy (E) is equal to the mass (m) multiplied by the speed of light (C) squared.</p>

Many webmaster's today prefer to use CSS as much as possible to replace html. In that case, you can replace the <sub> or <sup> with the <span> tag and then use the vertical-align style property to set the verticle position of the subscript or superscript, as shown below.

The chemical formula for water is H2O

<p>The chemical formula for water is H<span style="vertical-align:-0.5em">2</span>O</p>

Einstein's formula is E=mC2

<p>Einstein's formula is E=mC<span style="vertical-align:0.4em">2</span></p>

The above examples use in-line style to offset the subscript or superscript vertically by 0.5em. An em unit is equal to the height of the capital letter "M" in the currently defined font size.

1 This is the footnote text

RSS Feed RSS Feed



Web Design Sections

HTML5 for Masterminds

HTML5 for Masterminds

How to take advantage of HTML5 to create amazing websites and revolutionary applications

This book is not an introduction of HTML5 but instead a complete course that will teach you how to build compelling websites and amazing web applications from scratch. Every chapter explores basic concepts as well as complicated issues of HTML5, CSS3 and Javascript.

Concepts are supported by fully functional codes to guide beginners and experts through every single tag, style or function included in the specification.

Click here for more information.


[Site User Agreement] [Advertise on This site] [Search This Site] [Contact Form]
Copyright©2001-2011 Bucaro TecHelp 13771 N Fountain Hills Blvd Suite 114-248 Fountain Hills, AZ 85268