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!

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

Martin Batista
Martin Batista
4,606 Points

In task 2, I typed purple in element H1's color property without quotes and it still didn't work. I'm confused...

Need a little guidance on task two. I believe I did it correctly but still getting error message. I'm not sure if I'm having connection issues. Not sure if I should've jumped ahead and put in CSS yet or not.

<!doctype html>
    <link href="styles.css" rel="stylesheet">

    <h1 class= "tag" color='purple'> Welcome to My Web Page!</h1>

.tag {
  background-color: purple;
  color: white;
  padding: 10px;
  border-radius: 5px;
  display: table;
  margin: 10px auto;

2 Answers

Erik McClintock
Erik McClintock
45,783 Points


There are two different ways you could choose to tackle this type of situation, and either will work in this code challenge:

1) In the CSS file (you'll see a .css file in the two tabs just above the code in the challenge), you would target your h1 element, and then inside your code block, you'd list the color property and then set its color, as follows:

h1 {
    color: purple;

2) If you wanted to set the color how you're trying - that is, directly on the element in your HTML (which should be avoided, in general) - you would need to use the style attribute on your h1 element, then inside that attribute is where you would target and set your property.

<h1 style="color: purple;">Welcome to my web page</h1>

Happy coding!


Sean Kochel
Sean Kochel
1,693 Points

I'm new to this as well, but from the looks of what I see, your CSS may be overriding your 'purple' declaration. You are saying "use purple" in your HTML, and then saying color: white in your CSS, which would override the purple, I think