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

I am lost on the curly braces. I don't understand css.

None

index.html
<body>

  <style>
    color: blue;
  </style>
  {
  <style>css</style>
  }
    <h1>Sharon Weathers</h1>
</body>

2 Answers

Hugo Paz
Hugo Paz
15,622 Points

Hi Sharon,

You use curly braces to set rules on different elements.

Imagine you want to make all headers the colour red, with css you would do something like this.

<style>

h1, h2, h3, h4, h5, h6 {

color:red;
}

</style>

So in your example it should look like this:

<head>
<style>
h1{
    color: blue;
}
</style>
</head>
<body>
<h1>Sharon Weathers</h1>
</body>
Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,253 Points

Hi Sharon,

Further to what Hugo has said, the curly braces are what seperate your selector (which is the element you want to style in your CSS and your actual style rule.

CSS style are structured like this,

selector {

keyword: value;

}

with each statement separated by a semi colon. The Significance of the curly braces {} is that they separate your rule from the selector and they are required. :-)

e.g.

selector {

 keyword: value;

}



h1 {
  color: blue;
}