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

Amber McGuire
Amber McGuire
152 Points

text not turning blue

for some reason my code is not changing the text to blue. I do not know what im doing wrong. it looks exactly like the one online but its just not working.

<style>

h1 { color: blue; }

</style> <h1> Nate </h1>

9 Answers

So it is, Ted! Thanks!!

So, that should look like:

<style>

  h1 {
    color: blue;
  }

</style>
<h1>Steve Hunter</h1>

That should do it!

Steve.

That code looks fine. A few things:

  1. Have you saved your CSS file?
  2. Have you included the CSS file in the HTML using a link?
  3. Is there an h1 element in the HTML?
  4. I ran out.

Just a few things to look at! Steve.

As I recall, that part has the css in the html. If so, did you put it before your h1?

Another problem that I have seen is that it needs to be in the body tags for the quiz.

<body>
    <style>
        h1 {
            color: blue;
        }
    </style>
    <h1>Ted Sumner</h1>
</body>

Thankfully, the code challenge comes ready with the body elements pre-filled so that's one less thing to worry about!! :-)

True, but I helped someone who put the style before the body tag.

Ah yes - that wouldn't go well! I've made so many mistakes it's unbelievable! Still, it helps with the learning.

Please post your code if you want help. The Markdown Cheatsheet tells you how to format it properly.

michaelmugo
michaelmugo
3,971 Points

I realized sometimes you spell "colour" wrong without knowing! That fixed mine! should be color...

Ah yes, in all programming languages, I think, the American flavour (flavor) of colour is used, so you should default away from the English spelling and use color`.

Same with centre - the American version is always used too, center.

Marcus Watts
Marcus Watts
433 Points

I think it's a bug, because I have the same problem.

I have seen this problem many times and it has always been an error in the student's code, not a bug. Please post your code and we can help identify the problem with your code or figure out if it is really a bug. The Markdown Cheatsheet tells how to format the code quote.

Marcus Watts
Marcus Watts
433 Points

I have tried it with and without the body tags, and when I have put it another services version of a workspace it works fine.

https://w.trhou.se/j1snknezi5

That fork works fine for me. I think it may be a browser cache issue. Try clearing your cache. There is also a way to refresh and override the cache, but I don't remember the exact key sequence. It is something like control-F5, but you will want to google it to be sure.

Marcus Watts
Marcus Watts
433 Points

Thanks.

Yeah the problem was cache. I cleared it, and now it's fine.