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 Basic Selectors ID and Class Selectors

Angelica Islas
Angelica Islas
4,082 Points

I thought that I had already completed this challenge successfully...

I thought this was correct: <header class="main-header"></header>

index.html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Developer Diane: Resume</title>
  <link rel="stylesheet" href="page.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <main>
    <header>
      <div>
        <h1>Developer Diane: Resume</h1>
        <address>
          <p>website: developerdiane.com</p>
          <p>email: diane@developerdiane.com</p>
        </address>
        <img src="developer-diane.jpg" alt="Developer Diane coding on her laptop.">
      </div>
    </header>          
    <section>
      <h2>Experience</h2>
      <ul>
        <li>
          <h3>Super Web Design Shop</h3>
          <p>Junior Developer</p>
          <p class="date special">February 2020-present</p>
        </li>
        <li>
          <h3>Pretty Good Websites, Inc.</h3>
          <p>Web Development Intern</p>
          <p>July 2019-January 2020</p>
        </li>
      </ul>
    </section>
    <footer>©2020 Developer Diane.</footer>
  </main>
</body>
</html>
style.css
/* Complete the challenge by writing CSS below */
<header class="main-header"></header>

1 Answer

Brandon White
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Brandon White
Full Stack JavaScript Techdegree Graduate 35,771 Points

Hi Angelica,

You did complete the first challenge correctly, but the second challenge asks that you target the main-header class using css (specifically using what's referred to as the class selector). To do that, the code would look like the following:

/* Complete the challenge by writing CSS below */
.main-header {
  background-color: orange;
}

The class selector is referenced with a (.). After which is a pair of parenthesis used to denote the block of css properties and values that describes the styling of the element(s) selected.

Angelica Islas
Angelica Islas
4,082 Points

Hello. For the first challenge, I wrote in the style.css file: <header class="main-header"></header> and I got the following message: make sure you're defining a class attribute inside the <header> tag, and setting the value to 'main-header'.

Brandon White
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Brandon White
Full Stack JavaScript Techdegree Graduate 35,771 Points

My apologies, Angelica. Your code for the first part of the challenge is correct, you’re simply not meant to add it to the css file. You’re meant to find the header element inside the html file and add class=“main-header” to it.