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.
does ID still have higher priority if its in external css file whilst CLASS is written in internal file?
i get id overides class, and also know that inline>internal>external also. so does it make a difference if ID in external and class in internal (i cant imagine class being able to be use in inline or can you?) or will ID always win? thanks
John Lack-Wilson8,181 Points
Good question - I'd recommend seeing for yourself.
- Write a simple HTML document called index.html and add a div into the body.
- Add an ID of "test" to the div.
- Add some text into the div.
- Add a background of red to an external stylesheet and include this in the HTML
- Add a background of blue to the head of the document and see which has priority
- Add a background of green to the inline element
- See which takes priority