CSS Selectors

CSS Selectors are the most handy way to apply styles to select HTML elements. CSS Selectors are widely used in jQuery and HTML DOM Parsers etc.

a[href*="jpg"] {
color : green;
}

This will apply the style to all anchor tags which have their href tag linking to jpg images.

a[href*="jpg"][id="nav"] {
color : green;
}

This will apply the style to all anchor tags which have their href tag linking to jpg images AND (satisfy both requirements) which have id as “nav”.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>