Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

HTML Introduction to HTML and CSS Getting Familiar with HTML and CSS Test: Changing the Look of a Web Page

Chidiebere Ekeh
PLUS
Chidiebere Ekeh
Courses Plus Student 959 Points

how do i create h1 selector?

csmint.links@yahoo.com

index.html
<!doctype html>
<html>
  <head>
    <link href="styles.css" rel="stylesheet">
  </head>
  <body>

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

  </body>
</html>
styles.css
color: purple

3 Answers

Tobias Erich
PLUS
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. */

h1{
     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
PLUS
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
seal-mask
.a{fill-rule:evenodd;}techdegree
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: