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!

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 Getting Familiar with HTML and CSS Welcome to HTML and CSS

David Ferenc
David Ferenc
6,993 Points

tag name and tag location question

When you change color to Blue, it changes color by the class="tag name". Why it does not automatically apply also on class="tag location"? These both tags have .tag on them..

1 Answer

Max Senden
Max Senden
23,153 Points

Hi David,

You are correct. Both tag classes should have the same color.

However, .location has a background-color styling as well. Its styling appears after the .tag styling in the CSS document. Therefore the background-color of .location is rendered. If you place .location in front of the .tag (in the CSS document) you'll see that the background-color styling of .tag will render in your browser.

This behaviour is the nature of Cascading Style Sheets. Whichever styling is closest to the bottom of the CSS document is rendered in the HTML.

Hope it helps, and good question, Max