HTML abbr tag example

The doctype goes first in the code of every web page you create. The code that follows it will usually be HTML, so we'll discuss that next.

HTML is specified through the use of tags, also known as elements or markup.

Tags specify what content is. The thing defined by the tag – the content – is placed between opening and closing tags. With very few exceptions, the closing version of a tag is always the first word used in the opening tag with a slash (/) in front of it.

For example, a paragraph would be specified as follows:

<p>This is a paragraph</p>

Note that the closing tag shows where the thing being talked about ends. Without the closing tag, everything that occurred after the opening <p> would be assumed to be continuation of the paragraph, unless that new content had specific markup of its own.

All tags can use attributes. Attributes are always written inside the opening tag, and usually take the form x="y", that is, the attribute name followed by its value. Attributes add more information to a tag: what it means. In the example in the header illustration for this article, I have defined the word SAIT Polytechnic to be an abbreviation by using the appropriate tag. The title attribute for the tag defines what SAIT stands for.

A few common rules for elements:

  • A tag is always specified between < (less than) and > (greater than) symbols.
  • After the less than symbol, a tag will always consist of at least one letter (the link tag <a> for example), although it may also include numerals (such as a heading elements, like <h1>).
  • While HTML5 is case-insensitive, tags and attributes should always be written lowercase for readability. (Attribute values can be written in whatever way makes sense).