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 How to Make a Website CSS: Cascading Style Sheets Use ID Selectors

Sean Flanagan
Sean Flanagan
33,235 Points

What does # mean?

Hi guys and girls.

This may seem a ridiculous question, but I've only been a member of Treehouse for 3 days. What does # mean please?

Thanks

Sean

2 Answers

Gary Mead
Gary Mead
1,165 Points

The # is the id selector which is used to specify a style for a single, unique element.

Example: < div id="wrapper" > < /div >

And then on your .CSS file, apply formatting to that class:

"#wrapper { max-width: 940px; margin: 0 auto; padding: 0 5%; }"

Michael Austin
PLUS
Michael Austin
Courses Plus Student 7,814 Points

Hi,

It’s used in two areas, for IDs of tags and for colour palettes.

Tag IDs:

<div id=“me”>Hello</div>
#me{color:red}

Colour palettes: The # means that a hexadecimal colour reference will follow. For example #000 is black, #fff is white.

Have a look at this thread on StackOverflow, as it covers both the general and technical side of hexadecimal colours.

http://stackoverflow.com/questions/22239803/css-how-does-hexadecimal-color-work

Sean Flanagan
Sean Flanagan
33,235 Points

Hi Michael. Thanks for the link. I found it very helpful. :-)

Sean

Michael Austin
Michael Austin
Courses Plus Student 7,814 Points

Hi Sean,

Gary’s description is better for tag IDs as it’s related to the video (something I keep overlooking). I’ve covered two bases :)

Sean Flanagan
Sean Flanagan
33,235 Points

Fair enough. You've both been very helpful, in any case. :)