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 CSS Foundations Selectors Type, Class, and ID Selectors

I'm stuck on this question. How can I select h1 and make it darkblue.

I used the period and # to select it but I'm not sure why is not working. I tried it without it too.

index.html
<!DOCTYPE html>
<html>
<head>
    <title>CSS Selectors</title>
    <link rel="stylesheet" href="cc1-main-styles.css" type="text/css" media="screen">
    <link rel="stylesheet" href="style.css" type="text/css" media="screen">
</head>
<body>
    <h1><em>Hello</em> World!</h1>
    <div>
        <p>
            <em>Lorem ipsum dolor</em> sit amet, consectetur adipiscing elit. Nunc pulvinar consequat tortor, nec venenatis erat elementum scelerisque. Curabitur sit amet risus nisi. Aenean aliquet euismod augue at viverra. Ut varius arcu in lorem iaculis ullamcorper. Integer eu rutrum quam.
        </p>
    </div>
</body>
</html>
style.css
/* Complete the challenge by writing CSS below */
body {
  background: lightblue;
  {

#h1{
  color: darkblue;
}

1 Answer

Edward Bryan Kene Morales
Edward Bryan Kene Morales
7,374 Points

Hi Alejandro,

I'm afraid that your issue is because of syntax error of your code. I see two issues here. First, the closing curly brace of the body selector is written inverted:

Your wrote it as:

body {
  background: lightblue;
{

Whereas it should be written like this:

body { 
  background: lightblue;
}

The second thing is with your selector that targets the h1 tag. You do not need to append a # or dot to the h1 because an h1 alone is a valid css selector. In your question, writing

h1 {
  color: darkblue;
}

is enough. Remember that pound and dot symbols are used to target IDs and classes respectively. If you h1 have an id of say, "foo". Then you can write it this way:

h1#foo {
  color: darkblue;
}

or this way

#foo {
color: darkblue;
}

Hope this helps!

Yes, your right. Good Answer!