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

corey smith
PLUS
corey smith
Courses Plus Student 406 Points

what am i doing wrong

how do i set the <p> to red?

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
p .main-pg {
  border-color: 4px solid and red;
}

3 Answers

Jack Spangenberg
Jack Spangenberg
643 Points

Since you added the main-pg class to your paragraph, there is no need to specify that it is a paragraph in your CSS and you don't need to say and in your CSS. Also, You need to use border-style too.

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

To add onto Jack's answer, you can also use the shorthand style for your borders if you'd like.

You just have to change...

border-color: 4px solid and red;

To this...

border: 4px solid red;

Notice how I changed border-color to border? Using border lets you specify multiple border attributes all at once.

Ari Misha
Ari Misha
19,323 Points

Hiya Corey! Just remove "and" and "p" from your css , coz you have already selected ".main_pg" class which is a reference to the "p" tag. Also it should be just "border" . Here is the code for the reference:

.main-pg {
  border: 4px solid red;
}
Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hey Corey,

First, you don't need to specify the tag when selecting by class or id. So, you just need the main-pg.

You are on the right track with your rule, except for 2 things:

  1. To set the border, you use border.
  2. You don't include an and in the parameter list.

So, once all is corrected, the CSS will look like this:

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

Hope that helps. :) :dizzy: