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 almost always take the form
x="y". Attributes add more information to the tag as to what it means. In the example in the header illustration for this article, we 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 tags: