E[attr|="name"]

Matches any E element whose "attr" attribute value is a list of hyphen-separated values, the first being exactly equal to "name".

HTML:

  1. <p>Lorem ipsum dolor sit amet, consectetur</p>
  2. <p class="second-paragraph">Lorem ipsum dolor sit amet, consefctetur</p>

CSS:

  1. p{font-style:normal}
  2. p[class|="second"]{font-style:italic}

Output:

Lorem ipsum dolor sit amet, consectetur

Lorem ipsum dolor sit amet, consectetur

In the example, the second paragraph should be set in italics.