HTML and CSS Reference
In-Depth Information
2.7 XHTML—Text Formatting
Text can be formatted in various ways using logical style elements , physical style ele-
ments , and special characters . These are considered to be inline-level elements because
they can apply to either a section of text or a single character of text. This is not the
only method for formatting text; Cascading Style Sheets (introduced in Chapter 3) is
commonly used for this purpose.
FAQ
What about the font tag?
The <font> tag allows you to configure the typeface, color, and size of the text between the
<font> and </font> container tags. However, the <font> tag is deprecated. A deprecated
XHTML element or attribute is still supported by XHTML 1.0 Transitional and currently popular
browsers, but may not be supported in the future. The W3C recommends using Cascading
Style Sheets (see Chapter 3) to format text instead of using the <font> tag. If you'd like more
information about the <font> tag, see Appendix A, XHTML Reference.
XHTML Logical Style Elements
Logical style elements, sometimes called phrase elements, indicate the logical style used
to display the text between the container tags. It is up to each browser to interpret that
style. For example, the <strong> element indicates that the text associated with it be
displayed in a “strong” manner in relation to normal text on the page. Usually, but not
always, the browser (or other user agent) will display <strong> text in bold. A screen
reader, such as Jaws or Window-Eyes, might interpret <strong> text to indicate that
the text should be more strongly spoken. With more and more devices used to access
the Web, the use of logical style elements instead of physical style elements (whenever
possible) is preferred. Both are still used on the Web.
Note that all logical style elements are container tags—an opening and a closing tag
should be used. For example, if you wanted the phone number in the following line to
have a strong logical style
Call for a free quote for your Web development needs: 888.555.5555
the XHTML would look like
<p>Call for a free quote for your Web development needs:
<strong>888.555.5555</strong></p>
Notice that the <strong> opening and closing tags are contained within the paragraph
tags ( <p> and </p> ). This XHTML code is nested properly, follows XML syntax, and is
considered to be well formed. An example of improper nesting follows:
<p>Call for a free quote for your Web development needs:
<strong>888.555.5555</p></strong>
When improperly nested, the <p> and <strong> tag pairs overlap each other instead of
being nested within each other. Improperly nested code will not pass XHTML validation
 
Search WWH ::




Custom Search