Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS The Selectors Solution

attribute selectors? I was having trouble with the Practice CSS Selectors workshop because I haven't heard of these.

I googled what they were after the fact, but I don't think there was a video about attribute selectors in this course so I was confused as to how to do some of the practice problems.

Kevin Bullis
Kevin Bullis
13,770 Points

Sounds like you figured out what they were. Just in case, here's a good resource: https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors

These selectors are incredibly useful when you're working with someone else's code and don't have the ability to add classes or ids (without using JavaScript).

Kevin Bullis so my understanding is that if you have two or more of the same elements but they all have different attributes, and you want to make a selector out of only one of those specific elements, then using an attribute selector helps you specify the element and attribute you want to style?

1 Answer

Steven Parker
Steven Parker
231,269 Points

Attribute selectors are covered in detail in several of the videos in the CSS Selectors course. In fact, after the introductory overview, the very next one is titled Attribute Selectors.

Thank you, I'm on the Web Development track, working through the basic CSS selector videos, and I've only gotten through the Basic CSS Selectors course and Atrribute Selectors weren't on there. Kinda weird that they are included in the practice after the basic CSS selector videos but hey, I learned something more advanced so that's a good thing! :D