SELECT AN HTML ELEMENT USING A PARTIAL ATTRIBUTE VALUE

CSS3 has introduced new comparison tests to identify HTML tags with partial attribute values. You can use this in your CSS selector logic to match on attribute values that are not complete words and stylize them accordingly:

element[attr^='value'] { ... }element[attr$='value'] { ... }element[attr*='value'] { ... }

The ^= comparison matches elements whose attribute value begins with value. For example, object[type^='application'] will match all object elements whose MIME type begins with application, such as <object type='application/x-shockwaveflash'>.

The $= comparison matches elements whose attribute value ends with value. For example, form[action$='.pl'] will match all forms that use ...

Get HTML5: Your visual blueprint™ for designing rich web pages and applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.