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

CSS How to Make a Website Beginning HTML and CSS Write a CSS Selector and Property

Chun Yin Chan
Chun Yin Chan
303 Points

how to change the text color?

Why i can not change my text color?

index.html
  <style>
    .h1{
      color: #000000;
    }
  </style>

    <h1>Nick Pettit</h1>
Kern Tallett
Kern Tallett
10,012 Points

You don't need the . before h1.

h1 {
 color: #000000;
}

2 Answers

Abe Layee
Abe Layee
8,378 Points

You want to set the color to green not black. Also, remove the dot before the h1. We use dot on element with class name.

<body>
     <style>
       h1 {color:green;}
       </style>
    <h1>Nick Pettit</h1>
</body>
jason chan
jason chan
31,009 Points
<head>
<style>
.class {color:red;}
#id {color:green;}
p{color:tomato;}
</style>
</head>
<body>
<h1 class="class">This is a class</h1>
<p id="id">this is an id</p>
<p>I am a lonely selector</p>
</body>

I hope that helps.