attribute selectorsExplanationAttribute selectors extend significantly the class and id selectors introduced in CSS1. While the syntax is very different, class and id selectors are one simple aspect of what can be achieved with an attribute selector. Firstly, what is an attribute? If you aren't familiar with the term, attributes are the properties of HTML elements. Some simple examples you might have seen are For example, you can select any link with a particular SyntaxAttribute selectors have two parts. The first part is a selector that identifies an element generally (it might be an HTML element selector, or a more specific kind of selector such as a contextual selector). The second part specifies a condition for the attributes of the element. There are four kinds of condition:
An attribute selector selects an element where both
The first part of an attribute selector should be very familiar, it is simply one of the various selectors we are familiar with (for example an HTML element selector). The part of the selector that specifies the conditions for attributes is contained within square brackets "[" and "]". The syntax for each of the conditions described above is
UseAttribute selectors provide a much more sophisticated version of the class and ID selectors. They will be of particular importance with XML. Browser supportDetailed browser support information for this feature can be found in the full version of the Westciv CSS Guide, or in our CSS Browser Support Table. next: row & column selectors(C)1997-2001 Western Civilisation Pty. Ltd. |