HTML and CSS Reference
In-Depth Information
TAB LE 1.3
CSS Selectors Reference
SELECTOR
EXAMPLE
DESCRIPTION
BROWSER
SUPPORT
Universal
Selects everything on the page.
All
*
Attribute
img[alt]
Selects all of the specified elements that have the
specified attribute. Ideal for accessibility testing
if you want to highlight images with and without
alt attributes.
Not IE6 or
earlier.
Selects all of the specified elements that have the
specified attribute with the specified value. Useful
for selecting specific images or other elements
without needing extra IDs or classes.
Not IE6 or
earlier.
img[src="alert.gif”]
img[src^="alert"]
Selects all of the specified elements that have the
specified string at the start of the attribute value.
Not IE6 or
earlier.
Selects all of the specified elements that have the
specified string at the end of the attribute value.
Not IE6 or
earlier.
img[src$="gif"]
a[href*="uk"]
Selects all of the specified elements that have the
specified string somewhere inside the attribute
value. These are useful for adding special styling
or icons to specific content—for example, links to
resources just about the UK or links to PDFs.
Not IE6 or
earlier.
article[class~="feature"] Selects all of the specified elements that have the
specified string inside the attribute value, but only
if it is a single value in a space-delimited list of
values.
Not IE6 or
earlier.
article[id|="feature"]
Selects all of the specified elements that have the
specified string inside the attribute value, but only
if it is a single value in a hyphen-delimited list of
values. These last two selectors might be poten-
tially useful if you are trying to select elements
based on some kind of horrible tagging system
inserted into attributes by a CMS.
Not IE6 or
earlier.
 
Search WWH ::




Custom Search