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 trialBackston Makuve
951 PointsHow 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
<!doctype html>
<html>
<head>
<link href="styles.css" rel="stylesheet">
</head>
<body>
<h1>Welcome to My Web Page!</h1>
</body>
</html>
4 Answers
Akhter Rasool
8,597 Pointsin 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)
Backston Makuve
951 PointsThanks for the support Akhter it has worked out good .
Julio Andrade
Courses Plus Student 10,896 PointsIn the style.css
h1{ color:purple; }
or you can use hex code
h1{ color: #800080; }
Backston Makuve
951 PointsThanks Julio but want to know does colors have specific codes like the one you posted
Akhter Rasool
8,597 PointsYes 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
Backston Makuve
951 PointsThanks i didn't know that but it seems it didn't work out good
Akhter Rasool
8,597 PointsAkhter Rasool
8,597 Pointsin 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)