[Index] [Up] [Back] [Next]

2.1 Elements in HTML Documents

The interpreted instructions in HTML are called HTML elements . Elements are denoted by the tag <element_name> . This is simply the element name surrounded by left and right angle brackets. Most elements mark blocks of the document for particular purpose or formatting: the above <element_name> tag marks the beginning of such as section. The end of this section would then be marked by the ending tag </element_name> .

For example, the heading at the top of this page is marked by the element H1 (a level 1 heading) which is simply

<H1> 2. Elements in HTML </H1>.

Empty Elements

Some elements are empty: that is, they do not affect a block of the document in some way. These elements do not require an ending tag. An example is the <HR> element, which draws a horizontal line across the page. This element would simply be entered as
<HR>

Upper and Lower Case

Element names are case independent. Thus the the horizontal rule element can be written as any of <hr>, <Hr> or <HR>.

Elements can have Arguments

Many elements can have arguments that pass parameters to the interpreter handling this element. These arguments are called attributes of the element. For example, consider the element A, which marks a region of text as the beginning (or end) of a hypertext link. This element can have several attributes. One of them, HREF, specifies the hypertext document that the marked piece of text is linked to. To specify this in the tag for A we write
<A HREF="http://www.somewhere.ca/file.html"> marked text </a>.
so that the attribute HREF is assigned the indicated value. Note that the A element is not empty, and that it is closed by the tag </a>.

[Index] [Up] [Back] [Next]