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

Barak TheProgrammer
Barak TheProgrammer
1,773 Points

i cant continue with my studying because it asks me to change the color of h1 tag to purple

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

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

</body> </html>

and there`s nothing in the styles.css

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

    <h1>Welcome to Barak`s Web Page!</h1>

  </body>
</html>
styles.css
<

1 Answer

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,253 Points

Hi Barak,

You can't change the colour of the text using HTML. Technically you can put CSS styles in HTML attribute but for website projects this is not standard practice.

You use Cascading Style Sheets (CSS) to change the colour of text amongst other things.

Remember the format for CSS styles. A CSS Style is made up of its selector, property and value; like this

selector {
  property: selector;
}

With your selector, you select the element, or elements that you want to change. In this case you want to target the H1 element.

You want to target the color property and then you can use the purple keyword to actually change the colour of the text.

h1 {
 color: purple;
}

Put this into the CSS file provided in the challenge and it should work :)

Barak TheProgrammer
Barak TheProgrammer
1,773 Points

thanks! nothing to add. really good explanation