Websites by Mark

The h3 html tag – Websites by Mark

01305 881027 / 01993 820005

The h3 html tag

Overview

In HTML h tags stand for heading and this is split into 6 different h tags (h1, h2, h3, h4, h5 and h6). The <h3> tag itself is considered to be a medium repeating sub header for a webpage. By default it is displayed slightly larger than the body text but smaller than the <h2> header. As with all h tags it is considered important for SEO.When text is put between the opening and closing <h3> tag it is displayed as a Medium heading. Unlike <h1> a <h3> tag can be used multiple times on a webpage as its job is to be the heading for a web pages sub topics.

Basic Usage

<h3>Medium header text</h3>

Any text between the opening and closing tag will be displayed as a medium heading.

Advance Usage

It is possible to style and add functionality to the <h3> tag, this is done by adding an attribute to after the h3 in the opening <h3> tag

Attributes allowed for the <h3>tag include :-class, dir, id, lang, style and title.

In most cases class and id are used and its basic usage is shown below

<h3 id=”header”>Medium header text</h3>

With all attributes there is a space after the initial h3 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 <h3> 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 <h3> 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.

It is possible to attach scripts to tags, as well adding functionality to a webpage, these scripts tend to be written in Javascript and therefore outside the scope of this document

Examples

<h3>Medium header text</h3> – basic usage example.

<h3 id=”header”>Medium header text</h3> – heading 3 which is styled by the id header.

<h3 class=”headerclass”> Medium header text </h3> – heading 3 which is styled by the class headerclass.

<h3 id =”header” class=”headerclass”> Medium header text </h3> – heading 3 which is styled by the class headerclass and the id header.

<h3 style=”color:#F00″>Medium header text</h3> – heading 3 which has a custom colour of red.

<h3 dir=”rtl”>Medium header text</h3> – heading 3 where the text reads from right to left.

<h3 lang=”uk”>Medium header text</h3> – heading 3 where the language has been tagged as UK.

<h3 title=”ptitle”>Medium header text</h3> – heading 3 where the tag has been titled ptitle.

Final Thoughts

Touching on just the surface of the <h3> HTML tag it is easy to see how versatile it is. To take full advantage of it an understanding of CSS is an advantage.