HTML <small> Tag
The HTML <small>
tag is used to render text in a smaller font size than the surrounding text. It is typically used for disclaimers, legal text, or annotations. While it visually reduces the font size, the <small>
tag also adds semantic meaning, indicating less importance or auxiliary information.
By default, browsers style the <small>
tag with a smaller font size relative to its parent element.
Basic Syntax of HTML <small> Tag
The basic structure of the <small>
tag is:
<small>Smaller Text</small>
The enclosed text is displayed in a reduced font size.
Example of Using the <small> Tag
Here’s an example where the <small>
tag is used to add a disclaimer:
index.html
<!DOCTYPE html>
<html>
<body>
<h2>Product Description</h2>
<p>This product is available for a limited time only. <small>Terms and conditions apply.</small></p>
</body>
</html>
Explanation: The phrase “Terms and conditions apply” is rendered in a smaller font size to indicate its auxiliary nature.
Styling the <small> Tag with CSS
You can customize the appearance of text wrapped in the <small>
tag using CSS:
index.html
<!DOCTYPE html>
<html>
<head>
<style>
small {
font-size: 0.8em;
color: gray;
font-style: italic;
}
</style>
</head>
<body>
<h2>Disclaimer</h2>
<p>All prices are subject to change without notice. <small>Please contact support for details.</small></p>
</body>
</html>
Result: The text inside the <small>
tag is styled with a smaller font size, gray color, and italicized for better emphasis.
Attributes of HTML <small> Tag
- Global Attributes: The
<small>
tag supports all global attributes, such asid
,class
, andstyle
. - Event Attributes: You can attach event handlers like
onclick
,onmouseover
, etc.
These attributes enable further customization and interactivity for the <small>
tag.
Practical Applications of the <small> Tag
- Legal Text: Add disclaimers, terms, or copyright notices in a smaller font.
- Annotations: Provide additional explanations or references in a visually distinct way.
- Secondary Information: Display less important details, such as footnotes or metadata, in a smaller font size.
- Dynamic Interfaces: Use the
<small>
tag in user interfaces to de-emphasize supplementary text.
The <small>
tag is a useful semantic element for representing secondary or auxiliary information in a clean and accessible way.