HTML Tags

Elements in the HTML specification are indicated by tags. An HTML tag is made up of the element name followed by an optional list of attributes, all of which appears between angle brackets (< >). Nothing within the brackets is displayed in the browser. The tag name is generally an abbreviation of the element’s name or the tag’s function (this makes them fairly simple to learn). Attributes are properties that extend or refine the tag’s function.

In the current specification, the name and attributes within a tag are not case sensitive. <BODY BGCOLOR=white> works the same as <body bgcolor=white>. However, values for particular attributes may be case sensitive, particularly URLs and filenames.

Tip

Because tags are not case-sensitive in the HTML 4.01 specification, the tags in sample code throughout this book are written in all uppercase letters for improved readability. In future iterations of HTML (namely XHTML, discussed in Chapter 31), tags and attributes will be required to be all lowercase. While it is recommended that developers begin the good habit of coding in all lowercase immediately, this book follows the conventions for tag display established within the HTML 4.01 specification itself.

Containers

Most HTML elements or components are containers, meaning they have a start tag and an end tag. The text enclosed within the tags follows the tag’s instructions. In the following example, the <I> container tags make the enclosed text italic:

The weather is <I>gorgeous</I> ...

Get Web Design in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.