O'Reilly logo

HTML5 and CSS3: Visual QuickStart Guide, Seventh Edition by Bruce Hyslop, Elizabeth Castro

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

Selecting Elements Based on Attributes

You can also apply formatting to those elements that have a given attribute or attribute value.

To select elements to format based on their attributes

1. Type element, where element is the selector for the element whose attributes are in question.

2. Type [attribute, where attribute is the name of the attribute that an element must have to be selected.

Image For demonstration purposes, I’ve changed the class value on the second section element from project to work.

<article class="about">     <h1>Antoni Gaudí</h1>     <p>Many tourists are drawn to Barcelona to see Antoni Gaudí's incredible architecture.</p>     <p>Barcelona ...

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