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

Jenny Suh
Jenny Suh
200 Points

help with .main-pg set to paragraph class

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

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

   My amazing website</p>

  </body>
</html>
styles.css
<p> class=".main-pg"{

} 

2 Answers

Steven Parker
Steven Parker
176,322 Points

You've got the class part right, but you have parts of another element there also (h1). The class setting should go right after the "p" inside the "<p>" tag :point_right: <p class=".main-pg">

And nothing goes yet on the "styles.css" tab. When it does, the syntax will be different.

Gabriel Ruz
Gabriel Ruz
1,402 Points

When creating a class for an HTML element make sure to leave out the '.' when defining the class so for example:

You're asking to have the .main-pg set to paragraph class so it should be <p class="main-pg"> and not <p class=".main-pg">

And then when you're creating a declaration on the CSS style sheet to refer to the class you created you don't need to include the carrots.

To refer to a class element you simply just need to put the '.' to refer to any class created.

So it would be .main-pg

Steven Parker
Steven Parker
176,322 Points

Jenny Suh — Glad to help. You can mark a question solved by choosing a "best answer".
And happy coding!