Having the body copy in a web page all displayed as the same size is often normal, but there are times where by making certain parts of the copy slightly smaller, visually breaks up the text and makes it easier to read. In HTML the <small> tag can be used for this. The <small> tag is one of the original ways to format text and more recently CSS and other tags have reduced the importance of this tag. It is still a good tag when used correctly. When text is put between the opening and closing <small> tag it is displayed as small text. The <small> tag can be used multiple times on a webpage and can be nested inside other tags for dramatic effect.
<small>Some small text</small>
Any text between the opening and closing tag will be displayed as a large heading.
It is possible to style and add functionality to the <small> tag, this is done by adding an attribute to after the small in the opening <small> tag.
Attributes allowed for the <small>tag include :-class, dir, id, lang, style and title.
In most cases class and id are used and its basic usage is shown below
<small id=”header”>Some small text</small>
With all attributes there is a space after the initial b then the attribute name, then an equal’s sign and the identifier of the attribute in double quotes.
Both id and class attributes refer to CSS styling of the element and is either stored in the <head> of the webpage on in an external file.
With id this usually refers to a single instance on a page where as class usually refers to a repeating element on a page, it is for this reason for the <small> tag the class attribute is nearly always used over the id attribute although in practice it makes no difference.
The attribute style allows you to include css style information for a single <small> tag.
The dir attribute allows for left reading and right reading text, lang allows you to specify a language for the tag and title allows you to include extra information for a tag.
<small>Some small text</small> – basic usage example.
<small id=”header”>Some small text</small> – small text which is styled by the id header.
<small class=”headerclass”> Some small text </small> – small text which is styled by the class headerclass.
<small id =”header” class=”headerclass”> Some small text </small> – small text which is styled by the class headerclass and the id header.
<small style=”color:#F00″>Some small text</small> – small text which has a custom colour of red.
<small dir=”rtl”>Some small text</small> – small text where the text reads from right to left.
<small lang=”uk”>Some small text</small> – small text where the language has been tagged as UK.
<small title=”ptitle”>Some small text</small> – small text where the tag has been titled ptitle.
Touching on just the surface of the <small> HTML tag it is easy to see how versatile it is. To take full advantage of it an understanding of CSS is an advantage.