HTML and CSS Reference
In-Depth Information
Advanced selectors
Beyond the simple type, ID, and class selectors, there are an astounding variety of other
selectors available in CSS, which can all be chained on to a type selector if desired. Oth-
er types of selectors include the following:
Attribute selectors : Elements can be accessed based on their attributes, attribute
values, or parts thereof.
Pseudoclasses : Elements can be selected based on patterns found in their struc-
ture, their response to user interaction, their assigned language, or other proper-
ties that may not be directly set on an element.
Pseudoelements : Parts of elements that aren't explicitly defined in markup may
be accessed, such as the first letter or first line of text in an element.
And more! As you will soon see, ever more so, CSS has powerful logical rules that
can be designed to pick out specific chunks of HTML. Let's run through these other se-
lectors so you see what's new.
Attribute selectors
Technically, the ID and class selectors from earlier are attribute selectors, but their syn-
tax is different from the rest of the attribute selectors, so I've separated them. These se-
lectors can reference elements that have certain patterns in their attributes. Table 6-5
summarizes this bunch.
Search WWH ::




Custom Search