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

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;
}