HTML Introduction to HTML and CSS Make It Beautiful With CSS Test: Styling by Element and Class

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

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

<h1 class= "main-pg"></h1>
  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,463 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?