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

Jessica Diaz
Jessica Diaz
618 Points

How do you change the color of the h1 tag in style.css ?

I am trying the following:

h1 text:{ color: purple; }

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

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

text:{ color: purple; 
Jessica Diaz
Jessica Diaz
618 Points

This helps. Thanks Pamela

1 Answer

Hi Jessica Diaz,

In css we can select an element in 3 ways.

  1. By tagname like: body, h1, p
  2. By ID name like: #someIdName
  3. By class name like: .someName

If you haven't encountered (2) and (3) yet, don't worry, you will in the future.

After we select an element we enter opening and closing braces, everything we want to change to the element we selected will go in there.



Finally we can modify styling properties of this element with key:value pairs. First we define what want to change (key) then we specify the value we want it to have.

    color: purple;

Your code isn't working because you are selecting an element which does not exist within your page. There isn't a h1 text anywhere in your HTML document.

I hope this helped!


Jessica Diaz
Jessica Diaz
618 Points

This helps. Thanks