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

How do i change color of h1 tag to purple

How do i change the color of a h1 tag to purple on my web page.When i click css styles the page will remain blank with no information displayed .how to go about it

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

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

  </body>
</html>
styles.css

Akhter Rasool
Akhter Rasool
8,597 Points

in your style.css add the following code:

you define a rule like this : h1{ color:purple; }

h1 represents the name of the tag, the braces include a set of code which helps you apply css to that element(in this case h1) color represents the text color and purple is the value of the property (color)

4 Answers

Akhter Rasool
Akhter Rasool
8,597 Points

in your style.css add the following code:

you define a rule like this : h1{ color:purple; }

h1 represents the name of the tag, the braces include a set of code which helps you apply css to that element(in this case h1) color represents the text color and purple is the value of the property (color)

Thanks for the support Akhter it has worked out good .

Julio Andrade
PLUS
Julio Andrade
Courses Plus Student 10,896 Points

In the style.css

h1{ color:purple; }

or you can use hex code

h1{ color: #800080; }

Thanks Julio but want to know does colors have specific codes like the one you posted

Akhter Rasool
Akhter Rasool
8,597 Points

Yes different colors have different hex codes, you need not memorize those code,

you can search for hex-color pickers in google and get tons of those, you can play around and find the hex-code of each color . you need not memorize those. it's very normal if you cant remember those

Thanks i didn't know that but it seems it didn't work out good