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

HTML How to Make a Website Beginning HTML and CSS Write a CSS Selector and Property

CSS or HTML?

I'm working on my second challenge on the Website Track. I'm asked to write CSS that will select the h1.

My understanding is that h1{ } would be the correct answer. However, my answer is wrong and I'm reminded to include the curly braces.

Can anyone help?

-My HTML code so far:

body style h1> Nick Pettit </h /style /body

I don't have the option to open a CSS file, so the below code is also typed in idex.html folder. I believe the code below selects the h1 declaration - Nick Pettit.

h1 {

}

11 Answers

The body, style, and h1 tags need to be in their own brackets.

<body>
<h1>Nick Pettit</h1>
</body>

Since you don't have a .css file, you are going to need to use a style tag. You use that when you want to put your css directly in your HTML. So it would be something along the lines of

<body>
<style>
   h1{
      color: blue;
   }
</style>
<h1>Nick Pettit</h1>
</body>

If you try to just put the css in without the style tag, the browser will try to read it as HTML

You need to add an html tag, not a css rule. Here is a reference to the tag you need to add - http://www.w3schools.com/tags/tag_style.asp

Thank you! I found both of your answers helpful.

Would you be able to help with another question? The next question requires a change in the colour - green. My understanding of CSS is that I would have to use hexidecimal numbers. The code I created was h1 {color: #006400;} Why is this not correct?

Susan

Because this is not green color. Use the keyword GREEN instead of #006400 and everything should be fine. This is the hex value of green, in case you feel more comfortable using it: #00FF00.

It doesn't seem to work. It asks me to set the color of the h1 element to green. My code is: h1{ color: #00FF00:} What am I missing?

Susan

color: #00FF00 must end with ; not : Example: h1{ color: #00FF00;}

Sorry, that was a typing error. It still does'nt work when corrected. Susan

Did you tried with the key work green instead?

It didn't seem to work.

I put in: h1 {color: green;} I also tried h1 {color: #00FF00;}

An idea what I'm doing wrong?

Susan

This must work.

<body>
  <style>
    h1 {
      color: green;
    }
  </style>
    <h1>Nick Pettit</h1>
</body>

Thank you for your help. I've contacted support to request review because I now think it must be a bug. Susan