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 CSS Foundations Selectors Basic Attribute Selectors

shareyourpeace
shareyourpeace
3,244 Points

Are attribute selectors used in 2014?

Prior to learning on Treehouse, I have created some websites. I have never used 'attribute selectors' which are surrounded by [square brackets ] nor have I seen them used in other tutorials. Are they antiquated ? Honesty appreciated.

2 Answers

Ethan Lowry
PLUS
Ethan Lowry
Courses Plus Student 7,323 Points

Not at all, they're used frequently and can be extremely helpful sometimes. For example, if you wanted to select text field inputs only:

input[type="text"] { ... }

You can also do more advanced stuff like, say, select attributes that contain, start with or end with given values. So there's a lot of potentially cool stuff you can do with them.

There's a fairly nice article about them over on CSS-Tricks if you're interested in finding out more.

shareyourpeace
shareyourpeace
3,244 Points

Thanks. I now see the value as the course continued.