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


Nikki Turrisi
Nikki Turrisi
15,095 Points

Why is it in CSS that in order to identify certain properties, the syntax is different?

for example:

if I wanted to select the wrapper element, couldn't I just write:

wrapper {}

instead of ...

(hashtag) wrapper {}

--why is there a # in front of some, and not in front of others in the lesson?

2 Answers

{hashtag} is for id's
. is for classes
and nothing is for html elements.

To ellaborate the '#' and '.' are used for CSS specificity purposes. When you begin to build more complex web pages then you'll start using classes to chunk changes together rather than make the same change multiple times. for example.

#customer .tabContainer div {
   font: Arial, #000 solid;
   padding: 10px

You know you are pinpointing that part of the code because of the classes, id and tag. Then if want to be more specific then you would add either another class or id.