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 Review: Beginning HTML and CSS

I need help.The first color i put in my text is blue.The second one is green.But the blue color changed to green.

Well.Basically when I type the color coding and I input the word blue in the first headline and when I try to type another headline with a different color.The first headline color will change to the second headline color.

<style>

h1 { color: blue; }

</style> <h1>Hello</h1>

<style>

h1 {

color: Green;

}

</style> <h1>Im mak1sha.I like to play basketball</h1>

1 Answer

that is because css cascades down, meaning that the h1 element will take on whatever property is last on the list. if you want to have 2 different color level 1 headings then what you could do is give them a class for example

<style>

h1 { 
 color: blue; 
}

.example {
  color: green;
}

</style> 

<h1>Hello</h1>

<h1 class="example">Im mak1sha.I like to play basketball</h1>

you can also give the other heading a class if you only want that heading to be blue

remember that choosing the h1 element in your css will aply to every h1 in the the html document, so if you want to target a specific tag then you must give it a class and use that class in your css