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 Add Style to the Page

h1 needs to be in style tags

I typed what you typed and It didn't work. the h1 needs to be between the style tags.

<style>
color: blue; 
<h1>Hi Im Brent</h1> 
</style>

Video doesn't match the code test. Code test passed me with the above.

Stone Preston
Stone Preston
42,016 Points

in order for HTML and other code to show up in forum posts, you must format it using markdown. I formatted it for you so its displayed properly. There is a markdown cheatsheet in the bottom right of the text box, or you can also watch the tips for asking questions video on the right side of the page for a demonstration of how to use markdown.

3 Answers

Stone Preston
Stone Preston
42,016 Points

There are a couple things wrong with your answer.

your style tags are supposed to go above the h1 like this:

<style>
</style>
<h1>Hi Im Brent</h1> 

you also failed to select the h1 element using an h1 selector ( h1 { } ).

I passed with this code

<body>
    <style>
      h1 { color: green }
    </style>
    <h1>Nick Pettit</h1>
</body>

so you had a few errors in your original code that the challenge failed to catch it seems, and let you pass with incorrect code probably due to the way the engine parses the html/css code.

The challenge engine lets errors slip by pretty often, which can cause issues in some tasks

Hi Stone, I put this in the treehouse editor and the color doesn't change. I think it exactly how it is in the video. I just rewatched.

<style>

h1 {color: blue;}

</style>

<h1>Hi Im Brent</h1>

what am I missing?

Thanks,

Brent

Stone Preston
Stone Preston
42,016 Points

did you save your file before previewing it?

I did, The browser was caching the page and not refreshing even after hitting refresh. I hit f9 to clear cache and then refresh. It worked. I have style code working now or viewing now.

thanks,

Brent