IDEAlliance

© 2008 IDEAlliance
Incorporated. Contact
us at (703) 837-1070.

News

CSS Selectors Becomes Candidate Recommendation

On November 15, W3C announced Selectors as a Candidate Recommendation. This specification describes the CSS1 and CSS2 selectors and new selectors for CSS3. CSS binds style properties to elements using selectors, which are patterns that match one or more elements. The new Selectors specification describes the selectors that are proposed for CSS level 3. It includes and extends the selectors of CSS level 2.

A selector represents a structure in an XML or HTML document. This structure can be used as a condition, or CSS rule, to determine which elements a selector matches in the document tree, or as a flat description of the HTML or XML fragment corresponding to that structure.  In its simplest sense, a selector will be an element type.  But selectors for CSS Level 3 may also be a contextually rich description as well.

A selector is a chain of one or more sequences of simple selectors separated by combinators.  In other words, combinators enable us to combine simple selectors to create a complex selection specification.

Here is a selector made up of only one simple selector for the element type "h1":

    h1

Here is a selector made up of three simple selectors that are combined with a comma for the element type "p" "li" and "td":

    p, li, td

Selectors are used as conditions in constructing CSS rules to apply style to structures in an HTML or XML document.  See the two CSS style rules below:

    h1 {font-family: arial; font-size: 24pt; font-color: #003366}

    p, li {font-family: arial; font-size: 10pt}

The Selectors specification extends selectors defined in CSS2.  In this specification we see newly clarified basic definitions, an optional namespace component that is now allowed for specification of an element type, a new combinator, a new universal selector and the addition of attribute selectors.  In addition, Selectors is now an independent specification and a module of CSS3.

Return to TOC

 

Home  |  Events  |  Standards  |  Membership  |  News  |  Resources  |  About