HTML Treehouse Club: HTML Publish a Story Body, 1st level headline, and style tags

Jason Peay
Jason Peay
13,952 Points

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
MOD
Michael Afanasiev
Treehouse Moderator 15,554 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!

Jason Peay
Jason Peay
13,952 Points

Thanks for your help