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

whats wrong in this code

<style>

h1 

{ color:blue; } </style> <body> <h1>Hello there</h1> </body>

3 Answers

I'm guessing you need to do it this way in your CSS:

h1 {color: blue;}

and then declare this in your HTML:

<h1>Hello there</h1>

Yes as said above the "Hello there" has to be in the HTML body.

<!DOCTYPE html>
<html>

<head>
  <!--Add whatever you want here-->
</head>

<body>
  <h1>Hello there</h1>
</body>

</html>
Gerard Weppler
Gerard Weppler
4,357 Points

It is not best practice but you can use inline font color change. Should only be used temp or for testing.

see below:

<!DOCTYPE html> <html>

<head> <style> body {background-color:lightgray} h1 {color:blue} p {color:green} </style> </head>

<body> <h1>This is a heading</h1> <p>This is a paragraph.</p> </body>

</html>