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
Omer Asadullah
10,415 PointsWhy :root selector why not html type selector?
In video 4 of stage 3 namely Advanced Selectors of CSS deep dive, the instructor says that we use :root selector instead of using html type selector because :root selector has more specificity. I need some more elaboration on this with some examples that how :root is more specific and what advantage we can have with this specificity in terms of practical development of websites.
1 Answer
Dustin Matlock
33,856 PointsHey Omer!
Here's a resource on :root that should clear things up for you.
Omer Asadullah
10,415 PointsOmer Asadullah
10,415 PointsSo it means that html type selector will only work for html document where as root selector will select the root element no matter what format is used whether it is xml, svg or .html. So in this case root is more specific than html. Am I understanding it correctly?