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 Beginning HTML and CSS Write a CSS Selector and Property

Why in the video for the selector do I need no curly brackets to select h1 but in the challenge I do?

To select the h1 element within style on the video it showed h1 by itself without curly brackets but the color had them. Then in the challenge I'm supposed to use curly brackets to select h1, Do I need curly brackets to select h1 or any other element or not?

index.html
<body>
  <style>
    {h1}
  </style>  
  <h1>Nick Pettit</h1>
</body>

1 Answer

It would be like this:

h1 {
color: #fff
}

So the H1 itself is not wrapped in curly braces. The H1 in this case is your selector, color is your property, and #fff (white) is the value of that property.