HTML and CSS Reference
A golden rule in web site standardization is to separate content from appearance. External style sheets should be
preferred to inline styles except when only a small portion of a web page is styled. The syntax and naming convention
of external style sheets and the style attribute values are slightly different. To achieve the highest code quality, the style
sheets must be valid (error-free), and optimized in terms of scope, inheritance, and declaration order.
In this chapter, you will learn frequently used standards for styling web sites, including general CSS grammar
rules and selector syntaxes that are vital for every web site. After examining the differences between properties of
different CSS versions, you will gain a solid understanding of standardization issues and the challenges of providing
backward-compatibility. You will also become familiar with fundamental principles in CSS ruleset optimization.
Furthermore, you will analyze the methods used by rendering engines for determining the styles to apply.
Cascading Style Sheets
Cascading Style Sheets ( CSS ) is a style sheets language (style language) introduced by W3C. Cascading refers to the
process of determining the priority of styling rules. CSS is used to define the presentational semantics of structured
documents. It provides control over visual as well as aural 1 characteristics of HTML and XHTML documents and
their elements. Some typical features are, for example, fonts, colors, backgrounds, margins, borders, and layers. CSS
provides a powerful feature to support more than just visual media and target special browsers running on different
types of devices: media types. CSS supports not only the most commonly used visual media type but also other media
types that can be grouped as follows:
• Aural : Properties for aural browsers. Examples: pitch , pitch-range , play-during , richness ,
• Interactive : Properties for devices that allow user interaction. Examples: nav-down , nav-index ,
nav-left , nav-right , nav-up .
• Paged and noncontinuous : Properties for the content of documents split into one or more
discrete pages, such as the pages of documents to print. Examples: image-orientation , page ,
page-break-before , page-break-inside , page-policy , size .
• Speech : Properties for styling speech. Examples: cue , cue-after , cue-before , mark , mark-after ,
mark-before , pause , speak-header , speak-numeral , speak-punctuation , speech-rate , stress .
1 Although most styles associated with web documents are visual, CSS supports aural properties as well, including volume,
speaking, pause, cue, spatial properties, and voice characteristics. They are used for aural presentation, such as when a document is
converted to plain text and fed to a screen reader. Beyond improved accessibility, aural style sheets also have a potential in online
education, entertainment, in-car use, and so on.