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

Chase Brenny
Chase Brenny
107 Points

How do I change the color?

I don't know how to change the color of h1.

index.html
<!doctype html>
<html>
  <head>
    <link href="styles.css" rel="stylesheet">
  </head>
  <body>

    <h1purple>Welcome to My Web Page!</h1>

  </body>
</html>
styles.css

3 Answers

Joseph Frazer
Joseph Frazer
5,404 Points

Hello, Chase. In HTML you define tags:

<h1>Hello World</h1>

These tags structure the page. To style them, you use CSS. Link your CSS through HTML with the link tag:

<link rel="stylesheet" href="pathToStyle.css">

REL tells HTML that the file is CSS. HREF tells HTML the path to the CSS. Next we need to go through the CSS. First, select the tag:

h1 {

}

That selects the HTML tag H1. You can use the same for H2-H6, P, A, and more. Now, let's change the color:

h1 {
color: purple;
}

First, we select the color property. Then we change the color value to purple to make the text purple. I hope this helps. If you need any help you can ask me. :)

Eduard Fildiroiu
Eduard Fildiroiu
3,123 Points

In the styles.css you have to write:

h1{ color: purple; }

delete <h1purple> and only leave <h1>, in the index tab.