From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- devdocs/html/element%2Fsub.html | 112 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 devdocs/html/element%2Fsub.html (limited to 'devdocs/html/element%2Fsub.html') diff --git a/devdocs/html/element%2Fsub.html b/devdocs/html/element%2Fsub.html new file mode 100644 index 00000000..09dc74f1 --- /dev/null +++ b/devdocs/html/element%2Fsub.html @@ -0,0 +1,112 @@ +

<sub>: The Subscript element

The <sub> HTML element specifies inline text which should be displayed as subscript for solely typographical reasons. Subscripts are typically rendered with a lowered baseline using smaller text.

+

Try it

+
+

Attributes

+

This element only includes the global attributes.

+

Usage notes

+
+

The <sub> element should be used only for typographical reasons—that is, to change the position of the text to comply with typographical conventions or standards, rather than solely for presentation or appearance purposes.

For example, using <sub> to style the name of a company which uses altered baselines in their wordmark would not be appropriate; instead, CSS should be used. For example, you could use the vertical-align property with a declaration like vertical-align: sub or, to more precisely control the baseline shift, vertical-align: -25%.

Appropriate use cases for <sub> include (but aren't necessarily limited to):

+
+

Examples

+ +

Footnote numbers

+
+

Traditional footnotes are denoted using numbers which are rendered in subscript. This is a common use case for <sub>:

+

html

+
<p>
+  According to the computations by Nakamura, Johnson, and Mason<sub>1</sub> this
+  will result in the complete annihilation of both particles.
+</p>
+
+

Result

+
+ + +
+
+

Variable subscripts

+
+

In mathematics, families of variables related to the same concept (such as distances along the same axis) are represented using the same variable name with a subscript following. For example:

+

html

+
<p>
+  The horizontal coordinates' positions along the X-axis are represented as
+  <var>x<sub>1</sub></var><var>x<sub>n</sub></var>.
+</p>
+
+

Result

+
+ + +
+
+

Chemical formulas

+
+

When writing a chemical formula, such as H20, the number of atoms of a given element within the described molecule is represented using a subscripted number; in the case of water, the subscripted "2" indicates that there are two atoms of hydrogen in the molecule.

Another example:

+

html

+
<p>
+  Almost every developer's favorite molecule is
+  C<sub>8</sub>H<sub>10</sub>N<sub>4</sub>O<sub>2</sub>, which is commonly known
+  as "caffeine."
+</p>
+
+

Result

+
+ + +
+
+

Technical summary

+
Content categories Flow content, phrasing content, palpable content.
Permitted content +Phrasing content.
Tag omission None, both the starting and ending tag are mandatory.
Permitted parents Any element that accepts phrasing content.
Implicit ARIA role subscript
Permitted ARIA roles Any
DOM interface HTMLElement
+

Specifications

+
+ + +
Specification
HTML Standard
# the-sub-and-sup-elements
+

Browser compatibility

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariWebView AndroidChrome AndroidFirefox for AndroidOpera AndroidSafari on IOSSamsung Internet
sub1121Yes15≤44.418414≤3.21.0
+

See also

+
+

+ © 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
+ https://developer.mozilla.org/en-US/docs/Web/HTML/Element/sub +

+
-- cgit v1.2.3