Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
- :first-child and :last-child 4:15
- :first-child and :last-child Challenge 2 objectives
- :only-child and :empty 4:58
- Substring Matching Attribute Selectors - "Begins With" and "Ends With" 8:19
- Substring Matching Attribute Selectors - "Contains" 6:44
- Substring Matching Attribute Selectors Challenge 3 objectives
- Element States Pseudo-Classes 6:20
- Structural and Element States Pseudo-Classes Review 5 questions

- 2x 2x
- 1.75x 1.75x
- 1.5x 1.5x
- 1.25x 1.25x
- 1.1x 1.1x
- 1x 1x
- 0.75x 0.75x
- 0.5x 0.5x
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 up-
Ker Sing Tan
10,573 Points1 Answer
-
Terrence Kelley
5,067 Points1 Answer
-
Richard Norby
24,493 Points1 Answer
-
Benjamin Hedgepeth
5,672 Points1 Answer
-
rachaelallison
9,521 Points1 Answer
-
t y
362 PointsLets say I want to target the lake image and the trees image for a red border. Can I give the selector 2 values?
Posted by t yt y
362 Points3 Answers
-
Soufiane Bdaoui
9,602 Points2 Answers
View all discussions for this video
Related 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