HTML and CSS Reference
In-Depth Information
Declarations with Appropriate Specificity
Web developers often have to choose from a variety of settings and options. As a general rule, declarations should
be defined in a way that obtains the desired effect or functionality on the widest range of devices and settings. For
example, the color names reliably supported by CSS are limited to 16 colors (as discussed in Chapter 5). Although they
are known by all browsers and seem developer-friendly, the hexadecimal notation should be preferred because there
is no ultimate color list for the Web. Certain browsers support additional color names, but they are not standardized.
There is no reason to mix the basic color names and other color notations in the CSS. After all, hexadecimal notation
can produce virtually any color.
Since several web site features cannot be guaranteed by standardization, testing is vital in most cases.
Rendering in Multiple Browsers
Because of the differences of rendering engines, markup, and style, validity cannot ensure proper rendering under
different user agents. Consequently, the legibility and functionality of web sites should be checked on all major
browsers before publishing. 6 The more sophisticated the site design, the more complicated it is to provide similar
rendering under different browsers. There are freely available, browser-independent style sheets that eliminate this
time-consuming task. Good examples are the W3C Core Styles [15].
Readability Without Styles
An advanced method for testing web sites is to render them with the default style sheet of the browser. Properly
structured, logically constructed web documents remain legible without the style sheet(s) developed for them. This
test is also useful for checking content accessibility.
In this chapter, you learned standardized best practices that should be differentiated from the trends introduced
by enthusiastic content authors and developers. You can safely apply these time-proven techniques in almost all
scenarios and improve the overall web page quality, from code optimality to robust rendering.
The standard compliance of web sites created using the techniques and standards presented so far should be
approved by validation, which will be described in the next chapter.
6 As discussed in the previous chapter, some browsers provide the option to render web pages with different rendering engines, and
there are more and more plug-ins available for testing browser-independence on tabs.
Search WWH ::

Custom Search