Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
The “contains” substring matching attribute selector targets an element containing the piece of code we define anywhere in an attribute's value.
Quick Reference
Using substring matching attribute selectors
-
^
tells the browser to match a piece of code that’s at the beginning of an attribute's value -
$
matches a piece at the end of an attribute's value -
*
matches any part of an attribute's value
This selector matches an a
element containing the word blog
anywhere inside its href
value:
a[href*="blog"] {
border-bottom: solid 2px steelblue;
}
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up