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 Introduction to HTML and CSS (2016) Getting Familiar with HTML and CSS Test: Changing the Look of a Web Page

Chidiebere Ekeh
Chidiebere Ekeh
Courses Plus Student 959 Points

how do i create h1 selector?


<!doctype html>
    <link href="styles.css" rel="stylesheet">

    <h1>Welcome to My Web Page!</h1>

color: purple

3 Answers

Tobias Erich
Tobias Erich
Courses Plus Student 2,980 Points

Hey, you need to explain the browser WHAT he should do on WHICH element.

h1 {} /* This is the selector, which tells the browser the element you want to change. */

     color: purple; /* This is a declaration. It tells the browser what he should do with your selector */

Now the code should work. And don't forget the ; after a declaration as you can see in my example.

In your CSS, you would do the following:

h1 {
   color: purple;
Gustavo Winter
Gustavo Winter
Courses Plus Student 27,382 Points

I'm not sure about what are you asking, but your code is right to pass the challenge.

By the way, to create a h1 selector you need to open and close the tag like this:

      <h1>This is code!</h1>

This tag has many levels, like:

          <h1>This is code!</h1>
        <h2>This is code level 2</h2>
       <h3>This is code level 3</h3>

For more info, check the MDN- H1 Selector

Jennifer Nordell
Jennifer Nordell
Treehouse Teacher

Hi there! I've changed your comment to an answer :sparkles:

On a side note, the code and documentation that you've linked above are referencing the HTML element. You can take a look at the challenge linked at the top of the question. The selector is a term used in CSS to select the element. You can take a look at the MDN CSS Selector documentation. Thanks for helping out in the Community! :sparkles: