Page 107 - Electronic Commerce
P. 107
Chapter 2
HTML Tags
An HTML document contains document text and elements. The tags in an HTML
82 document are interpreted by the Web browser and used by it to format the display of the
text enclosed by the tags. In HTML, the tags are enclosed in angle brackets (<>). Most
HTML tags have an opening tag and a closing tag that format the text between them. The
closing tag is preceded by a slash within the angle brackets (</>). The general form of an
HTML element is:
<tagname properties>Displayed information affected by tag</tagname>
Two good examples of HTML tag pairs are the strong character-formatting tags and
the emphasis character-formatting tags. For example, a Web browser reading the following
line of text:
<strong>A Review of the Book <em>HTML Is Fun!</em></strong>
would recognize the <strong> and </strong> tags as instructions to display the entire line
of text in bold and the <em> and </em> tags as instructions to display the text enclosed
by those tags in italics. The Web browser would display the text as:
A Review of the Book HTML Is Fun!
Some Web browsers allow the user to customize the interpretations of the tags so
that different Web browsers might display the tagged text differently. For example, one
Web browser might display text enclosed by strong tags in a blue color instead of
displaying the text as bold. Tags are generally written in lowercase letters; however, older
versions of HTML allowed the use of either case and you might still see Web pages that
include uppercase (or mixed case) HTML tags. Although most tags are two-sided (they use
both an opening and a closing tag), some are not. Tags that only require opening tags are
known as one-sided tags. The tag that creates a line break (</br>) is a common one-sided
tag. Some tags, such as the paragraph tag (<p>…</p>), are two-sided tags for which the
closing tag is optional. Designers sometimes omit the optional closing tags, but this
practice is poor markup style.
In a two-sided tag set, the closing tag position is very important. For example, if you
were to omit the closing bold tag in the preceding example, any text that followed the line
would be bolded. Sometimes an opening tag contains one or more property modifiers that
further refine how the tag operates. A tag’s property might modify a text display, or it
might designate where to find a graphic element. Figure 2-6 (on the next page) shows
some sample text marked up with HTML tags and Figure 2-7 (on page 84) shows this text
as it appears in a Web browser. The tags in these two figures are among the most common
HTML tags in use today on the Web.
Copyright 2015 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.