O'Reilly logo

HTML5: Your visual blueprint™ for designing rich web pages and applications by Adam McDaniel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required