HyperTextMarkupLanguage

HTML basics- Part 1
Elements, Tags, Attributes

| Home | HTML basics- Part 1 - Agenda | Next |

HTML Elements

An element consists of an opening and a closing tag. There are two type of elements:
  1. Container Elements:

    have opening and closing tags are referred to as container elements,

  2. Empty elements:

    do not have closing tags.

What are tags?


CORRECT <tag1>...<tag2>.....</tag2>...</tag1>
INCORRECT <tag1>...<tag2>.....</tag1>...</tag2>

What are attributes

Elements can have attributes, which provide additional information about the enclosed text. These attributes can be added to the opening tags. They cannot be repeated within an element. They are never added to closing tags.

An attribute consists of a name and (most of the times) a value. The value may be enclosed in quotes ("), and must be enclosed in quotes if the value contains more than just letters, digits, hyphens and/or periods.

An example of an attribute is the background attribute on the body element for this page:

<body background="/cgi400c2/htmlback.gif">

The attribute is background and the value is /cgi400c2/htmlback.gif which is enclosed in quotes. This attribute defines the image to be used in the background. Because the value consists only of letters, the quotes are optional.


| Home | HTML basics- Part 1 - Agenda | Next |

T07D010