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

How can I select the H1 when writing the CSS?

Write CSS that will select the H1 and do not forget the curly brackets?

2 Answers

Hi Lizbeth, when selecting an HTML element, you simply state that element, as below

h1 { background: white; }

no need for prefixes. Hope this helps

hi!, its easy right before open your .css file put h1 { color: black; } ( for example)

and if you want a clearly difference between h1's you can put id or class and some name (id="title1" , class="title1") and then modify on your css file.:D .

To expand on this... There is no need to specify a class unless you are specifying between multiple H1 elements. For example, if there is only one H1 element in your code, then you can use the following code...

<style>
  h1 {
    color: green;
  }
</style>
<h1>Page Title</h1>

If you choose to have multiple H1 elements on your page but wish to use different styles, you can specify a certain class or ID to differentiate between the two as shown below...

<style>
  h1.title1 {
    color: green;
    font-weight: normal;
  }
  h1.title2 {
    color: blue;
    font-weight: bold;
  }
</style>
<h1 class="title1">Title Two</h1>
<h1 class="title2">Title Two</h1>

Hope this helps =)