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 Basics (2014) Basic Selectors ID and Class Selectors

Ok there must be a glitch here as I cannot seem to get past this step? It tells me task one is no longer correct?

Yet it is when I go back to task one. My code for targeting main-heading is correct I know, please advise?

index.html
<!DOCTYPE html>
<html>
  <head>
    <title>Lake Tahoe</title>
    <link rel="stylesheet" href="page.css">
    <link rel="stylesheet" href="style.css">
  </head>
  <body> 
    <header id= "main-header">
      <span>Journey through the Sierra Nevada Mountains</span>
      <h1 class="main-heading">Lake Tahoe, California</h1>
    </header>
    <p>
      Lake Tahoe is one of the most breathtaking attractions located in California. It's home to a number of ski resorts, summer outdoor recreation, and tourist attractions. Snow and skiing are a significant part of the area's reputation.
    </p>
    <a href="#">Find out more</a>
    <div>
      <h2>Check out all the Wildlife</h2>
      <p>
        As spawning season approaches, the fish acquire a humpback and protuberant jaw. After spawning, they die and their carcasses provide a feast for gatherings of mink, bears, and Bald eagles.
      </p>
      <a href="#">See the Wildlife</a>
    </div>

  </body>
</html>
style.css
/* Complete the challenge by writing CSS below */

.main-header {
  background-color: orange; 
}

.main-heading {
  font-size: 72px;
}

4 Answers

Adam Dakin
Adam Dakin
7,373 Points

You are using the wrong selector for the main-header. The main-header is an id so you use the selector #.

e.g

#main-header {
  background-color: orange;
}

hope this helps! :)

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! Step 1 asks that you assign the class "main-header" to the the <header> element, but your code shows an id of "main-header". This will not pass Step 1 in its current form. I'm not sure when or how the class got turned into an ID, but I cannot make it pass step 1 as an ID.

When I change id="main-header" to class="main-header", I can get as far as Step 5.

Hope this helps! :sparkles:

Also, be careful not to include a space between your equals sign and your quotation marks.

<header class="main-header"> This is how my step one shows in my code

Jennifer Nordell
seal-mask
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

And that's how it should look. But that being said, look at the code posted in your question. There it is not class, but rather id.

Thanks I have completed the challenge! Whoo hoo!