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

Why is my css not working?

For some reason my css is not working, but it seems good to me

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 {
          border: 4px, solid, red;
}

2 Answers

Samuel Glister
Samuel Glister
12,471 Points

Hi Wilfredo,

Pay close attention to when you write out you class attributes, it looks like you have put a space before the '='

Your link should look like this (assuming the css file is in the same as the index.html).

<p class="main-pg">hello world</p>

I hope this helps.

edit - I have also noticed on your css that you have commas between each part of your statement it doesn't need this like below

.main-pg {
          border: 4px solid red;
}
Maximillian Fox
PLUS
Maximillian Fox
Courses Plus Student 9,236 Points

You have

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

Just remove the commas

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