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) Getting Familiar with HTML and CSS Test: Changing the Look of a Web Page

how do i write css

i was half way through the initial stage and i'm told to make a css change out of nowhere. Please help?

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

    <p>Welcome to My Web Page!</p>

  </body>
</html>
styles.css

2 Answers

You begin writing your CSS under your styles.css tab.

Don't worry, it's pretty simple. The challenge is asking you to change the color of your <h1> to purple. So in your CSS tab, write your selector which is h1. Then use the color property to change its color.

h1 { color: purple; }

Don't forget the important of beginning and ending a new rule with your opening and closing curly brackets.

In the code editor, you can switch between the index.html tab and the styles.css tab. You should write this:

h1 {
  color: purple;
}

In the styles.css tab.


Here's how the CSS turns all H1s to purple:

  1. We select all H1s by using h1.
  2. Inside of the {}, we specify how we want to style all h1s. Why h1s? That's because we told CSS we wanted to style h1s in the selection.
  3. We set the color property to the color value of purple. Remember to end the line with a semicolon! It's like ending a sentence with a period to CSS.

I hope this helps :grin:

Happy coding! :tada:

:dizzy: ~Alex :dizzy: