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

h1 color

Hey there, I can't figure out what I'm f'in up here..

"<body> <style type="text/css"> .h1:{ color: #00ff00; }

</style>
<h1>Nick Pettit</h1>

</body>

5 Answers

Richard Duncan
Richard Duncan
5,568 Points

You don't need a period before an element selector in CSS. Your rule would imply that you are adding that color to a class of .h1 rather than the element h1.

You also need to drop the : from after the element selector. Correct syntax illustrated below.

h1 {

}

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

When I take out the period it still doesn't work...

Richard Duncan
Richard Duncan
5,568 Points

Updated my answer to include the correct syntax. Hope this helps.

Jan Van Raemdonck
Jan Van Raemdonck
22,961 Points

you have to take out the period before and the colon after the h1

Thanks! That worked.