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 trialTonetta Grovesnor
858 PointsIm trying to add css for <h1> text-align:right; color:red but it keeps saying it is wrong please help me
please explain css
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Once Upon a Time</title>
<style>
h1 {text-align:left; color:green}
</style>
</head>
<Body><h1> Once Upon A Time</h1>
</Body><h1> Once Upon A Time</h1>
<h1> {text-align:right; color:red}
</html>
2 Answers
Sander de Wijs
Courses Plus Student 22,267 PointsHi Tonetta,
You should place all your styling rules between the <style> tags in the head of your webpage. Also, you did not properly close the <body> tag. Also, if you want to declare different styles for different h1 elements, you should give them a class
```<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Once Upon a Time</title> <style> h1.red {text-align:right; color:red} h1.green {text-align:right; color:green} </style> </head>
<Body>
<h1 class="red"> Once Upon A Time</h1>
<h1 class="green"> Once Upon A Time</h1>
</Body>
</html>
bzfchen
6,484 PointsNotice the embedded css in the head. It will affect all h1 elements on your page.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Once Upon a Time</title>
<style>
h1 {text-align:right; color:red}
</style>
</head>
<body>
<h1>Once Upon a Time</h1>
</body>
</html>