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 How to Make a Website Beginning HTML and CSS Write a CSS Selector and Property

need help adding style element

it says don't forget your style tag need help... need like an example

2 Answers

Michael Hulet
Michael Hulet
47,912 Points

It's asking you to write CSS in your HTML document (as opposed to writing your CSS in a separate file), and this is done with the <style></style> tag. This code passes the entire challenge:

<body>
    <style>
      h1{
        color: green;
      }
    </style>
    <h1>Nick Pettit</h1>
</body>

As you can see, it's just like writing normal CSS, but you just write it in between a <style></style> tag directly in your HTML

Scott Crawford
Scott Crawford
37,861 Points

Not sure exactly who/what "it" is but a style tag is used to add style elements within your html code. You can also do this using a CSS stylesheet instead which makes it look a lot cleaner. Anyway, here's an example from w3schools.com with some additions. It shows a style tag used to change the body color to yellow and paragraph text to blue.

<!DOCTYPE html> <html>

<head> <style> body {background-color:yellow;} p {color:blue;} </style> </head> <body> <p>This text will be blue</p> </body>

</html>