rs79.vrx.palo-alto.ca.us

Select based on attribute

Select all attributes that match in the IMG tag.

img[title] { border: 1px solid #000; }
img[width] { border: 1px solid #000; }
img[alt] { border: 1px solid #000; }


Set a new img src with css to replace one called out in the html:

img[src="setting-icon.png"] {
    border: 1px solid #000000;
    content:url("/new/image/source.png");
}

Select hyphen separated instances of a value

The example below will select any image whose attribute (in this case "title") has a hyphen separated list - in this case any title that includes "small-".

img[title|="small"] { border: 1px solid #000; }


Select space separated instances of a value

The example below will select any image whose attribute (in this case "alt") contains a space separated list of words - in this case any "alt" that includes the word "small".

img[alt~="small"] { border: 1px solid #000; }


Select based on value

Select when an attribute has a specific value.

img[src="small.gif"] { border: 1px solid #000; }