Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

HTML Introduction to HTML and CSS Getting Familiar with HTML and CSS Test: Changing the Look of a Web Page

Scott Strubberg
Scott Strubberg
3,244 Points

having a hard time setting my text to purple in the 2nd task on first challenge.

halp!

index.html
<!doctype html>
<html>
  <head>
    <link href="styles.css" rel="stylesheet">
  </head>
  <body>
    <p class="h1"></p> 
    <h1>Welcome to My Web Page!</h1>

  </body>
</html>
styles.css
.h1 {
  color: purple;
}

In the first task you changed the paragraph <p> to an <h1>. But now you are giving the Paragraph a class of h1 which is un-necessary since there is no text in the Paragraph. When you select the h1 in the CSS you don't need to select a class. You can just select the h1 element like so:

h1 { color: purple; }

1 Answer

Steven Parker
Steven Parker
221,106 Points

When selecting by tag name, don't put a dot (period) before the name.

The dot is for selecting by class name. So as it is now, your CSS rule only targets the empty paragraph instead of the h1 element.

Also, I don't think adding another paragraph is part of the challenge.