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
CSS gives us the flexibility of being able to target an element by any of its HTML attributes and values.
Quick Reference
Using attribute selectors
This attribute selector targets any element that has a class
attribute:
[class] {
border: solid 1px #ccc;
}
To target an input
element with a type
value of submit
, we write:
input[type="submit"] {
background-color: green;
}
This targets a
elements with a target
value of _blank
:
a[target="_blank"] {
color: tomato;
}
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