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 trialCam Treschuk
7,378 Pointsuniversal selectors
Couldn't you just select the body instead of using a universal selector?
1 Answer
Austin Whipple
29,725 PointsCertainly could. However, selecting the body
applies styles ONLY to the body element while the universal selector *
applies styles to EVERY element on the page. It's a powerful selector, so use with caution.
Occasionally the overview videos don't use the optimum selector for a situation, but rather one they'd like to explain at that moment. When coding in the wild, you'll appreciate the knowledge to be able to pick the one that works best for your use case.
Adnan Pozegić
12,789 PointsAdnan Pozegić
12,789 PointsTo add to this: You may be confused because some properties are inherited, while others are not. For example, setting a
font-family: Helvetica;
on the body element will make all other elements inherit that font-family value (if they don't have their own font-family property set).Austin Whipple
29,725 PointsAustin Whipple
29,725 PointsGood point, Adnan! I should have mentioned inherited properties. Here's a brief MDN reference article on inheritance. Hard to find a complete and current list of all inherited properties, so definitely check the individual property pages to check. Most inherited properties relate to fonts, lists, and tables. Not many deal with layout.