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 trialcorey smith
Courses Plus Student 406 Pointswhat am i doing wrong
how do i set the <p> to red?
<!doctype html>
<html>
<head>
<link href="styles.css" rel="stylesheet">
</head>
<body>
<p class="main-pg" >My amazing website</p>
</body>
</html>
p .main-pg {
border-color: 4px solid and red;
}
3 Answers
Jack Spangenberg
643 PointsSince 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;
}
Ari Misha
19,323 PointsHiya 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
Treehouse Moderator 145,860 PointsHey 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:
- To set the border, you use
border
. - 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. :)
Frank Torchia
18,346 PointsFrank Torchia
18,346 PointsTo 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
toborder
? Usingborder
lets you specify multiple border attributes all at once.