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

Add a class called "main-pg" to the paragraph element.

the body and the html sign at the end is getting red . the program is still telling me bummer

index.html
<!doctype html>
<html>
  <head>
    <link href="styles.css" rel="stylesheet">
  </head>
  <body>

    <p>My amazing website</p>
    <p> <h2 class="main-pg" >

  </body>
</html>
styles.css

9 Answers

victor cooper
victor cooper
6,436 Points

Hello there!

<p>My amazing website</p>
<p> <h2 class="main-pg" >

The first paragraph <p> ... </p> is good, what comes after you can remove, <p> <h2 class="main-pg" > is not necessary here, after you remove them to the first paragraph add a class main-pg. like this

<p class="main-pg"> ...</p>

Hope this helps

Thank you!

it doesn't show anything red on html but still doesn't accept it .should I do something In css?

Tadeáš Firich
Tadeáš Firich
7,866 Points

Please paste your code then we can help you. :)

Add a class called "main-pg" to the paragraph element.

Tadeáš Firich
Tadeáš Firich
7,866 Points

Hello Andras Matyo, the text of the challenge is "Add a class called "main-pg" to the paragraph element". Go to the challenge and focus on line 8.

<p>My amazing website</p>

This line represents text: My amazing website, and it is bounded by two p elements. If you want to add the class you just type class behind the p tag. Like this:

<p class="">My amazing website</p>

Others are already up to you. Was it helpful for you?

You need to set the 'class' attribute of the <p> element to "main-pg

victor cooper
victor cooper
6,436 Points

Could you show your current code? we could see whats wrong and help

<link href="styles.css" rel="stylesheet"> </head> <body>

<p>My amazing website</p>
<p> <h2 class="main-pg>  </p>

</body> </html>

victor cooper
victor cooper
6,436 Points
<!doctype html>
<html>
  <head>
    <link href="styles.css" rel="stylesheet">
  </head>
  <body>

    <p class="main-pg">My amazing website</p>

  </body>
</html>

<link href="styles.css" rel="stylesheet"> </head> <body>

<p>My amazing website</p>
<p> <h2 class="main-pg>  </p>

</body> </html>

it has worked! thank you again!