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

Brandon Schneider
Brandon Schneider
1,284 Points

can someone tell me how I can make my paragraph a red color and a solid font with a border of 4px please.

please help

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

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

  </body>
</html>
styles.css
.main-pg{
        text-align: center;
}
main-pg{
  border: 4px
  border color: red
  border element: solid
}

2 Answers

Jamie Reardon
Jamie Reardon
3,793 Points

Hi, good answer Michael however you are also missing a syntax punctuation on your code as well.

For the correct result, try this code.

.main-pg {
  border: 4px solid red;
}
Michael Cook
Michael Cook
11,226 Points

Right you are. I didn't add the period before the class name.

Michael Cook
Michael Cook
11,226 Points

Hey Brandon, there are a few things syntactically incorrect with your code. I wouldn't be alarmed by this though. As you go on through this basic course you do other HTML and CSS courses, you will type so many lines of HTML and CSS that the proper syntax will become second nature. Try this:

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

When you are working with the border property in CSS, you can specify all the aspects of the border in a single line like above. You could also specify aspects of your border individually, but why bother when there is a convenient single-line way of doing it? If you want to read about the border property you can here: https://developer.mozilla.org/en-US/docs/Web/CSS/border

Good luck!