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

Raymond Franks
Raymond Franks
180 Points

How do I set the color of the h1 element

setting the color on an h1 element

index.html
<style> </style>
    <h1>Nick Pettit</h1>
  h1{
    color:{green;
  }

</style> <style>
<h1>Raymond Franks</h1>
  h1{
      color:{blue;
      }
      h1{

2 Answers

In your index.html file, you should only have the <h1> elements eg:

<h1>Nick Petit</h1>

<h1>Another Name</h1>

Then, you need a separate file - your CSS file - probably called something like main.css. That file will contain your CSS, like :

h1 {
  color: blue
}
Laura White
Laura White
495 Points

Also, once you create the separate css file as discussed above, be sure to add this directly below your title tags if you haven't already:

<link rel="stylesheet" type="text/css" href="css/main.css">

Then, save your css file in a file called css that is on the same level as your html document on your computer.