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

Parwiz Rahimi
PLUS
Parwiz Rahimi
Courses Plus Student 118 Points

write CSS that select h1

hi every one, i just started my first class to day, i am stuck in this question, write CSS select h1?

index.html
<style>
  color: red;
  </style>
<h1>Parwiz</h1>
<h1> select</h1>

2 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! You set up your style tag properly and even wrote your rule correctly, so that's. a pretty good job for day #1 in my humble opinion. However, it seems you're stuck on how to select an element to apply that rule to. So let's see if I can give you an example using a paragraph <p> instead of a headline <h1> and see if you can get it. I'm betting you can!

<style>
p {
  color: blue;
}
</style>

When we select an element we simply write the name of the tag such as p, h2, div... etc. Then we put our rules pertaining to that tag inside a set of open and closed curly braces. Each rule should end in a semicolon, which you also did correctly! :thumbsup:

The above code will select the paragraph element(s) and then make the font color blue. I hope this helps, but let me know if you're still stuck! :sparkles:

millogt
millogt
7,644 Points

Make sure to read the question properly so u understand it and know what to do. When u start out with HTML and CSS (like me) things can sound a bit confusing at first. U have to write CSS that selects h1 and dont forget the curly braces/brackets. U dont have to use the word 'select' as u did in your code. Just have a look at how Jennifer explained it and at her example. Dont make things too complicated :)