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 Grouping and Modifying Selectors

class selectors

I got confused with classes during my interaction with the following:

<p class: "intro">

and

<div class= "meaningfulnamehere">

Aren't they both classes? What's the difference?

Β‘Thank you

2 Answers

I think you got confused between pseudo class and the class.

The first example is slightly wrong but it indicates the pseudo class in CSS that can be used with attribute tag to specify the state of the attribute.For instance, p:visited {}. and second is the correct syntax for declaring class in CSS. And of course I am sure you know dot can be used with class name to access in CSS.

I hope this helps.

The first one is not correct.

When you give an element a class in your html, you use = not :

So the second one is correct.