Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

HTML Introduction to HTML and CSS 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,286 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,692 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: