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
Jonathan Yngfors
19,290 PointsOverride inline xml with external css
How can we override the inline xml with external css through classes. Is that not against the cascading order?
2 Answers
jcorum
71,830 PointsInteresting question. Did a little test. Added a style and a class attribute to a p tag, and a .red class to the css external style sheet:
<p style="color:blue; margin-left:30px;" class="red">
Refreshed the page. The text was blue. Firebug's CSS viewer showed both CSS rules, but had the class rule crossed out. Didn't make any difference on the order of the attributes. In fact, Firebug's inspector showed the above in reverse order, i.e., with the class attribute first, even though it wasn't first in the underlying html.
So it seems the rule that inline styles trump both internal and external style sheets really is correct.
Jonathan Yngfors
19,290 PointsBut when styling svg images, internal and external style sheets override the inline xml styling. How come?