Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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

Why is the program not reading the style tag that I have coded in?

The sixth time recodeing the style tag I checked the video and copied it exactly but still I get " Bummer! Don't forget your style tag." Why? Plus you forgot to mention about using the arrow keys to move up and down the lines of code instead of trying to move the cursor to the line and clicking in which doesn't work.

Ryan Watson
Ryan Watson
5,471 Points

In the future, include your code in your post. While HTML5 allows limited use of <style> tags in the <body> section of an HTML page, follow best practices and put your <style> tags in the <head> section of your HTML page.

This is what you need to do to style an element using style tags:

  <head>
       <!--**********************Style Tags Go Here**********************************--> 
       <style> /*Opening Style Tag*/

            h1{
                   color: red;     /*This will make the font color of all h1 elemets red*/
           }

       </style> <!--Closing Style Tag-->
       <!--*********************************************************************************-->  
  </head>

  <body>
       <h1>Hello Treehouse</h1>  <!--The font color of this h1 element will be red--> 
  </body>
Markus Ylisiurunen
Markus Ylisiurunen
15,034 Points

The question is about the exact challenge and there you should put it as I said. It won't accept it inside of <head> element.

Ryan Watson
Ryan Watson
5,471 Points

My apologies for any confusion. I am new to posting on the forum. In a real world environment, my example follows best practices, but that is not the point of this forum post.

The example provided by Markus is correct for this code challenge.

Markus Ylisiurunen
Markus Ylisiurunen
15,034 Points

As Ryan said, his example is definitely the one you should use in a real situation. But this code challenge wants the version I posted earlier. Which is kind of weird because you should never use that in real project.

So basically Ryan was also right, but his answer just don't work on this particular challenge.

1 Answer

Markus Ylisiurunen
Markus Ylisiurunen
15,034 Points

Hi!

Next time add your code to the question so we can debug your code!

This is what you should do:

<body>
    <style></style>
    <h1>Nick Pettit</h1>
</body>