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 Introduction to HTML and CSS (2016) Make It Beautiful With CSS Test: Styling by Element and Class

casey bova
PLUS
casey bova
Courses Plus Student 1,541 Points

I need hep understand if I am doing this last challenge right or wrong pleas help .

index.html
<!doctype html>
<html>
  <head>
    <link href="styles.css" rel="stylesheet">
  </head>
  <body>
    <h1 class= "main-pg"></h1>
    <p class= "main-pg"></p>

  </body>
</html>
styles.css
<h1 class= "main-pg"></h1>
.main-pg{
  border: 4px solid red;
}

Did the instructions say add "main-pg" class to h1 tag? I may be mistaken but I didnt see it.

Also in your styles.css file your h1 tag looks suspicious.

2 Answers

The instructions ask you to add class="main-pg" to the paragraph element. You've done that, though usually there is not a space in between the = and the class name. There is no mention of the h1 in the challenge. If there were though, and we were going by the html you wrote, the class declaration .main-pg in your css would target both the h1 and p elements because they share that class name. So there would be no need to target your h1 in particular unless you needed to do something with that element specifically. If you were to target it, (there are a number of ways to do so) you would not need your <h1> </h1> tags. You would just use whatever selector you choose (h1 for example) followed by the usual opening and closing {}. Hope this helps.

Alexander Cross
Alexander Cross
1,667 Points

Doing the same for me...

class.main-pg { border: solid red 4px; }

I'm getting an error, saying 'you need to make the box red'

Did you mange to find the right answer?