When you want the Web browser to display text on a Web page, you simply type the text you want
displayed between the start and end body tags (<body></body>) of the Web page HTML. As the
Web browser reads the HTML document, the browser displays any text it finds onscreen. To tell
the browser how you want the text to look, enclose the text between a pair of formatting tags. (HTML
provides tags you can use to instruct the browser to apply such formatting options as bold, italic, and
strikethrough.) You need to understand that Web browsers do not recognize normal formatting codes
embedded in documents by word processors like Microsoft Word.
Suppose, for example, that you want specific words in your Web document to appear in
boldface. To boldface a letter, word, or group of words, enclose the desired text between
start and end bold tags (<b></b>) such as those shown around the word “bold” in the following:
The last word in this sentence is <b>bold</b>
Character formatting tags are container tags, meaning they require both a start and an end tag.
The Web browser will apply the formatting instruction to all the text within the “container,” that is
to all the text between the start and end formatting tags. In this example, the start and end bold tags
(<bold> </bold>) that enclose the word “bold” instruct the Web browser to display the word in
boldface type as bold. As mentioned previously, you can use character formatting tags to specify
the appearance of several sentences (or even paragraphs), groups of words, individual words, or
even a single letter within a word. For example, when the browser displays the text in the following
HTML, only the letter “B” in the word “Bold” will display in boldface.
The first letter is <b>B</b>old
In addition to the start and end bold tags (<b></b>), you can use the following tags to enhance the
look of text on a Web page:
• <cite> </cite> The citation tags emphasize text, usually in italics.
• <code> </code> The code tag sets the enclosed text in a monospace font such as Courier to
set off the text. Use the code tags to identify a piece of HTML code within a training document.
• <del> </del> The deleted text tags mark text as deleted by striking through the text.
For example, use the deleted tags to mark through information in a legal document.
• <q> </q> The quotation tags surround the enclosed text with quotation marks.
• <sub> </sub> The subscript tags create a subscript, or display the text slightly lower
than the surrounding text.
• <sup> </sup> The superscript tags create a superscript, or display the text slightly higher
than the surrounding text.
• <em> </em> The emphasis tags highlight text by changing the enclosed words into italic font.
• <strong> </strong> The strong tags highlight text by bolding and italicizing the enclosed words.
• <i> </i> The italic tags highlight text by italicizing the enclosed words.
• <u> </u> The underline tags highlight text by underlining the enclosed words. This tag
is deprecated.
You can use formatting tags singularly or in combination. The following example combines the
start and end bold tags (<b></b>) and the start and end superscript tags (<super></super>) to make
the word “super” stand out on the page.
Character formatting tags are a <super><b>super</b></super> way
to grab the attention of a visitor to your Web page.
Although character formatting tags visually changes text within the browser window, a more
efficient way to change text styles and adhere to the W3C recommendations is to use CSS rules.
0 comments:
Post a Comment