HTML Introduction to HTML and CSS 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

Nils Kriedner
Nils Kriedner
Front End Web Development Techdegree Student 19,058 Points

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. :-)