HTML and CSS Reference
In-Depth Information
There are other propriety CSS prefixes that may be encountered, which may or may not
follow the appropriate prefixing scheme. For example, wireless phones that support WAP
(Wireless Application Protocol) may use -wap- prefix based properties such as -wap-
accesskey . Some implementations of Microsoft Office may use CSS rules like mso- , such
as mso-header-data . Do note that this syntax lacks the appropriate extension character
indicator. In general, it would seem that extensions should be avoided if possible unless
their presentation degrades gracefully, particularly since their compatibility and future
support by browsers or standards bodies is far from clear. Interestingly, many extension
properties appear to be CSS3 properties with stems just waiting for the specifications to
catch up. Chapter 6 will show this to be the case in numerous instances.
CSS Relationship with Markup
As CSS relies on markup and in some cases overlaps with older features provided by markup
elements, it is important to understand the relationship between the two technologies. In
general, transitional versions of (X)HTML markup include some presentational elements that
may be utilized by Web developers in place of CSS, while strict variants of (X)HTML may
eliminate such elements solely in favor of CSS properties. As an example, to center a heading
tag, the align attribute might be used like so:
<h1 align="center"> Headline Centered </h1>
In the case of strict markup, however, the align attribute is deprecated and thus CSS
should be employed. This could be accomplished either using an inline style like so
<h1 style="text-align: center;"> Headline Centered </h1>
or, more appropriately, with some CSS rule applied via class , id , or element selector. Here
we use a class rule
h1.centered {text-align: center;}
which would apply to tags with class values containing “centered” like the following:
<h1 class="centered"> Centered Headline </h1>
<h1 class="fancy centered"> Another Centered Headline </h1>
In some cases, we find that various HTML elements simply are no longer necessary in
the presence of CSS. For example, instead of tags like <u> , <sub> , <sup> , <font> , and
others, CSS rules are used often with generic elements like div or span . Table 4-3 details
most of the (X)HTML markup elements or attributes deprecated in strict variants and
presents their CSS alternatives.
There are other cases, like <sub> , <sup> , <big> , <small> , and many more, where we
could avoid using markup and apply style. The various markup specifications have not
deprecated every presentational-like element, and even if CSS alleviates the need for some
presentational elements, their usage stubbornly lives on. For that simple fact, these elements
and their equivalents are presented in this topic. In fact, the continued inclusion of presentation
ideas in the emerging HTML5 specification tends to suggest that despite a desire to move to
a purely semantic markup world, while certainly worthwhile, this is unlikely to come to pass
on the Web at large, at least not rapidly.
Search WWH ::

Custom Search