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

Differences between selectors.

What would be the difference between these?

Form[Class="Form-contact"]{ color: red; }

and

Form .Form-contact{ color: red; }

2 Answers

The first one is an attribute selector, whereas the second is a class selector.

In this simple example they both do the same thing, as Alexander mentioned.

However you can be more selective with an attribute selector. Below is a lowdown on the different ways you can select items with an attibute selector:

https://css-tricks.com/almanac/selectors/a/attribute/

Actually, I believe they are precisely the same thing! I usually use the second one, because it is a little more readable to me.

Good luck programming! :)

Hope this helps, ~Alex