HTML Tags
Every HTML tag is made up of a tag name, sometimes followed by an optional list of attributes, all of which appears between angle brackets < >. Nothing within the brackets will be displayed in the browser. The tag name is generally an abbreviation of the tag’s function (this makes them fairly simple to learn). Attributes are properties that extend or refine the tag’s function.
The name and attributes within a tag are not case sensitive.
<BODY BGCOLOR=white> will work the same as
<body bgcolor=white>.
However, values for particular attributes may be case sensitive,
particularly URLs and filenames.
Containers
Most HTML tags are containers, meaning they have a beginning (also called “opener” or “start”) tag and an end tag. The text enclosed within the tags will follow the tag’s instructions, as in the following example:
The weather is <I>gorgeous</I> today.
Result: The weather is gorgeous today.
An end tag contains the same name as the start tag, but it is preceded by a slash ( / ). You can think of it as an “off " switch for the tag. End tags never contain attributes.
For some tags, the end tag is optional and the browser determines
when the tag ends by context. This practice is most common with the
<p> (paragraph) tag. Browsers have supported
the <p> tag without its end tag, so many web authors take advantage of the shortcut. Not all tags allow this, however, and not all browsers are forgiving, so when in doubt include the end tag. This is especially important when using Cascading ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access