HTML, A Markup Language
HTML is not a programming language. Rather, it is used for describing the layout and format of content, written in the form of simple text.
An HTML page is a basic text file containing tags for specifying text format, images, etc. The use of these tags is called markup.
How do you use HTML markup?
A tag is a text element (a name) flanked by a less-than sign (<) and greater-than sign (>). For example, "<H1>".
||HTML tags are not case-sensitive, meaning that it doesn't matter if they are entered in uppercase or lowercase letters.
HTML tags work in pairs, and affect whichever elements they are surrounding. The first one is called the opening tag, and the second one is called the closing tag. The closing tag begins with a backslash ( / ):
<tag> Your formatted text; </tag>
For example, the tags <b> and </b> are used to put the text around them in bold letters:
<b> This text is in bold </b>
Some HTML tags are used alone rather than in pairs: the <br> tag, for example, represents a line break.
||However, in order to stay as close as possible to the XHTML standard (which is much more strict than standard HTML), the following notation is recommended: <br />.
HTML tags can be nested within one another, to allow multiple properties to be applied to the same text. However, overlapping tags are not tolerated by the HTML standard. Here is an example of formatted text with nested tags:
<i><u>How Does It Work</u>, the free IT encyclopedia</i>
The example above gives the following result:
How Does It Work, the free IT encyclopedia
But the example below is incorrect:
<i><b>How Does It Work</i>, the free IT encyclopedia</b>
An attribute is an element found within the opening tag that lets you define additional properties. Attributes are most often displayed as a name=value pair, but some attributes may sometimes be defined only by their name.
Here's an example of an attribute for a <p> tag (which defines a paragraph), specifying that the text must be right-aligned:
<p align="right">Example paragraph</p>
Each tag may include one or several attributes, each one with one or several values, or even none.
Spaces, line breaks, and tabs
HTML language disregards spaces, tabs, and line breaks, or more precisely, it considers a string of one or multiple spaces/tabs/line breaks to be a single space. This lets HTML code be indented to be more readable, without changing how the HTML page appears in the browser.
||Note: The one exception is for code contained within
<PRE> tags, whose very purpose is to keep text formatted (spaces, line breaks, etc.)
The following two portions of HTML code give the same result:
Example of HTML code
However, HTML has ways of expressly defining each of these layout elements:
- Non-breaking space: A space which cannot be broken up by the end of a line. Its HTML encoding is .
- Manual line break: An explicit line break. Its HTML encoding is <br> (<br /> for compliance with XHTML).
||Note: The <NOBR> </NOBR> tag does the opposite, preventing the browser from breaking up a line automatically!
Information can be added to a web page without being shown on the screen, with a special set of tags called comment tags.
<!-- This is a comment -->
Comment tags are for commenting on text but can also be used to comment on the HTML code itself.
||Note: The one exception is for code contained within <PRE> tags, whose very purpose is to keep text formatted (spaces, line breaks, etc.).
Latest update on October 16, 2008 at 09:43 AM by Jeff.