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 HTML First Use HTML Elements

Morgan Garner
Morgan Garner
688 Points

How do you do add in elements?

I want a green header; how do I get it?

index.html
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>
      {color: green}
    </title>
    <title>Morgan Garner | Travel the World</title>
   </head>
   <body>
     <header>
       <h1>
         {color: green}
       </h1>
       <h1>Morgan Garner</h1>
       <h2>Travel the World</h2>
     </header>
     <section>
       {color: green}
     </section>
     <section>Something will go here.</section>
     <footer>
       <p>
         {color: green}
       </p>
       <p>Little by little one travels far</p>
     </footer>
   </body>
</html>

1 Answer

Grace Kelly
Grace Kelly
33,990 Points

Hi Morgan, usually when styling HTML elements you do so in a CSS file and link it to the html, but to do some quick and simple styling you can do the following:

<h1 style="color: green"> This is green </h1>

or you can do this using CSS inside a style tag:

<head>
     <style>
          h1 {
                 color: green;
               }
     </style>
</head>

As you can see I have placed the style tags inside the head tags as you must do this, note however that this method will apply the green color to ALL h1 elements.

Hope this helps!!