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 How to Make a Website Beginning HTML and CSS Write a CSS Selector and Property

Josh Stone
Josh Stone
2,096 Points

How do i set the element of h1 to green

<h1><style><h1> { h1 }

2 Answers

Hey Josh,

You have to make sure your stylesheet is properly linked, a way I test this is by writing an inline style block to test. To set your h1 globally to green you need to type this in your stylesheet, either inline or external:

Of course you can use hexadecimal values if you wish, a list of them can be found here: https://developer.mozilla.org/en/docs/Web/CSS/color_value.

Also remember that to go out of your current directory the file is in you do ../ or /.

If this does not work, please post your code and I will do my best to help you.

h1 {
 color: green;
}
<html>
<head>
 <link rel="stylesheet" href="pathtostylesheetfile">
</head>
<body>
  <h1>Hello, world!</h1>
</body>
</html>

Regards,

Richard.

Hey Josh,

also inline stylesheets, that is internal ones in a document either html or php are:

<html>
<head>
  <style>
   h1 {
       color: green;
  }
  </style>
</head>
<body>
  <h1>Hello, world!</h1>
</body>
</html>

Regards,

Richard.