Web Development and Design Foundations with XHTML, 5th Edition

(Steven Felgate) #1
2.7 XHTML—Text Formatting^45

Table 2.5Physical style elements


Element Example Usage
<b> boldtext Displays text as bold
<i> emphasizedtext Displays text in italics
<big> bigtext Displays text larger than normal size

<small> smalltext Displays text smaller than normal size
<sub> subtext Displays small text below the baseline
<sup> suptext Displays small text above the baseline
<strike> striketext Displays text with a line through it (deprecated)
<u> utext Displays text underlined; avoid using this because underlined text can be con-
fused with hyperlinks (deprecated)
<tt> teletypetext Displays text in teletype or fixed-space font

You may have noticed that the <strong>logical style tag usually has the same effect as
the <b>physical style tag. Also, the <em>logical style tag usually has the same effect as
the <i>physical style tag. In order to create XHTML that describes logical styles
instead of font instructions for browsers, use <strong>instead of <b>and use <em>
instead of <i>. As you continue to study Web development, you will learn about
Cascading Style Sheets and their use in text formatting.

Special XHTML Characters


In order to use special characters such as quotation marks, greater than (>), lesser than
(<), and the copyright symbol (©) in your Web document, you need to use special char-
acters, sometimes called entity characters. For example, if you wanted to include a
copyright line on your page as follows:
© Copyright 2008 My Company. All rights reserved.
You would use the special character ©to display the copyright symbol. The
XHTML would look as follows:
<p>© Copyright 2008 My Company. All rights reserved.</p>
Another useful special character is  , which stands for nonbreaking space. You
may have noticed that Web browsers treat multiple spaces as a single space. If you need
a small number of spaces in your text, you may use  multiple times to indicate
multiple blank spaces. This is acceptable if you simply need to tweak the position of an
element a little. If you find that your Web pages contain many  special charac-
ters in a row, you should use a different method to align elements, such as a table or
Cascading Style Sheets.
See Table 2.6 and Appendix B, Special Characters, for a description of special charac-
ters and their codes.
Free download pdf