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

What am I not doing correctly

Creating a border: setting the P element to red/ Does it have something to do with a CSS rule?

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

    <p class="main-pg">My amazing website</p>
    .main-pg {border:4px solid red;}


  </body>
</html>
styles.css
.main-pg{}

1 Answer

joelearner
joelearner
36,480 Points

Hi Briona,

It looks like you have CSS instructions in your HTML file. Your HTML file should look like this:

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

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

  </body>
</html>

Then, since you have the class main-pg defined in the <p> tag, your CSS file is where you will put the styling instructions at. Like this:

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

Cheers!