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 Introduction to HTML and CSS (2016) Getting Familiar with HTML and CSS Test: Changing the Look of a Web Page

change the color of h1 tag to purple

change the color of h1 tag to purple

index.html
<!doctype html>
<html>
  <head>
    <link href="styles.css" rel="stylesheet">
  </head>
  <body>
    <h1 color ="purple"><Welcome to My Web Page!</h1>


  </body>
</html>
styles.css
h1 {
  color: blue;
}
Brandon Gormley
Brandon Gormley
6,147 Points

Hey Naima,

You have to remove the "<" right before Welcome to my Web Page, and the color tag must be placed inside a syle tag such as:

<h1 style="color:purple;">Welcome to My Web Page!</h1>

1 Answer

Hi Naima,

I have answered you also in your newer post about this task... Have a look at that too...

In this version you can delete the inline style declaration in your <h1> tag because the challenge actually wants you to write it in the css stylesheet.

But if you want to change the color of the <h1> inline (in you <h1> tag) then it has to have the following syntax:

<h1 style="color:purple;">Welcome to my webpage!</h1>

But it's generally better to style your page in a separate stylesheet (as you also did).

And in your css declaration (in your stylesheet) you did a good job declaring the color for the h1. The syntax is correct, but you declared "blue" instead of "purple" which is what is asked in the challenge.

So the second thing to do: Change the color attribute to "purple".

Then everything should work!

Happy coding!

PS: You can upvote my post and/or mark as "best answer" (at the bottom of my post) if it helped you. :-)