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
Marion B
435 PointsHow to start a rule according to what?
Hello,
I was wondering what's the difference in a css rule between "#" "." and "empty space" and how to use those elements. Here are the 3 examples:
- #gallery {
- .profile-picture {
- body {
Thanks!
1 Answer
Simon Duchaine
14,441 PointsHi Marion,
These refers to three different selectors.
The first one, the hash (#) is to select an id in your html markup. For example:
<div>
<h2 id="example">This is an example H2</h2>
</div>
Then the dot (.profile-picture) is to select a class in your html. For instance:
<div>
<h2 class="example">This is an example H2 with class example</h2>
</div>
Finaly, the last one is to select an html tag itself (body, nav, html, footer, div, etc.)
I hope my answer will help you better understand how to select html elements in CSS !
Marion B
435 PointsMarion B
435 PointsIt makes sense to me now! Thank you for your fast answer, Simon!