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 trialGeorge Chatzispiros
2,912 PointsWhat about conflicts between linked css files and imported ones with duplicated styles and classes?
e.g. same body style but different values to each style
2 Answers
Steven Parker
231,275 PointsBecause of the cascading nature of style sheets (the "C" in "CSS"), whichever rule comes last will take precedence over other rules of the same or lower specificity.
And a rule with higher specificity will take precedence no matter which order it is loaded.
George Chatzispiros
2,912 PointsThanks a lot for your fast response!
Aakash Srivastav
Full Stack JavaScript Techdegree Student 11,638 PointsAakash Srivastav
Full Stack JavaScript Techdegree Student 11,638 PointsHow do we know which have higher specificity? I am confused.
Steven Parker
231,275 PointsSteven Parker
231,275 PointsSpecificity is determined by the number and type of identifiers in the selector. For example, a class name is considered more specific than a tag name, and an ID is more specific than a class name. And two of the same type is more specific than one of that type.
For more details, see this MDN page on Specificity.
Aakash Srivastav
Full Stack JavaScript Techdegree Student 11,638 PointsAakash Srivastav
Full Stack JavaScript Techdegree Student 11,638 PointsGot it..Thanks Steven :)