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

writing rules in css

how do i write a rule in class="main-pg">

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

4 Answers

In the challenge click on the Styles tab, you will then be able to add the CSS rules.

thanks ,worked

Rhys Kearns
Rhys Kearns
4,976 Points

Styles tab like Martin Jones said or you can do inline css and do <styles></styles> in the head and type your styles in there, but dont do this if you have a .css document

do i go to the styles.css page? and i reviewed video and im still not getting it right.

Rhys Kearns
Rhys Kearns
4,976 Points

Yes styles.css page is where you would write your css - What are you trying to do with css?

Donald Morman
Donald Morman
1,050 Points

There's also an extra < before My amazing website. Once you correct that and make the necessary changes on the .css sheet. You should be good to go.

Rhys Kearns
Rhys Kearns
4,976 Points

Ok i just did the challenge to see what was wrong -

<!doctype html>
<html>
  <head>
    <link href="styles.css" rel="stylesheet">
  </head>
  <body>

    <p class="main-pg">My amazing website</p>

  </body>
</html>
.main-pg {
  border: 4px solid red;
}

Thats the challenge done - you only needed to create the rule for the second challenge which is .main-pg {} and then third challenge is to make a border 4px wide solid red.