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 Treehouse Club: HTML Publish a Story Body, 1st level headline, and style tags

How to change the CSS element for <h1>?

Change the text align to be right, and change the color to red.

  • Change text align properly to 'right' like this text-align: right;
index.html
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Once Upon a Time</title>
    <style>
        h1 {text-align:left; color:green}
    </style>
</head>
  <body>Once upon a time, there lived a lovely princess</body> 
  <body>And they live together, forever</body>
  <body><h1>Once upon a time<h1></body>
</html><h1{text-align: 'right; color:red}

1 Answer

Michael Afanasiev
PLUS
Michael Afanasiev
Courses Plus Student 15,596 Points

Hi Jason,

You've done good! but few things I noticed: You've added multiple body tags, and we're only suppose to add 1 body tag per page.

You added your styling at the end of your HTML, which will take no effect. It should be selected within your Style tags (You'll soon learn about external styling like CSS).

If you feel lost, that's how it should look like:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Once Upon a Time</title>   
    <style>
        h1 {text-align:right; colour:red}   <------- Your styling.
    </style>
</head>
  <body>
    <h1>Once Upon a Time</h1>   <------ One body tag with its content inside.
  </body>
</html> <----- Nothing should come after your html tags, ever! :P

Hope this helps, keep on coding!

Thanks for your help