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 trialHumoyunmirzo Nosirov
Courses Plus Student 5,154 Pointscan anyone explain what universal selector is , is it this "*"
how can we use that
1 Answer
Konstantinos Aggelidis
4,981 PointsA universal selector is indeed the * This is useful when you want to set a style for of all the elements of an HTML page For example you may want to set the color for your entire page to blue. Instead of targeting each element one by one, you may type:
- { color: blue; }
That way, all elements will have the color:blue. An asterisk can also be followed by a selector so you can set a style for all of the elements within an element of an HTML page.
In general, using universal selectors in not considered a best practice, but they may come in handy in some cases (at least that is what is mentioned in the course, since I do not have any experience of front-end development)
Hope that helps :)