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

CSS CSS Basics (2014) Basic Selectors Basic Selectors Review

Raihan Khan
Raihan Khan
2,168 Points

What is the difference between universal class and regular class?

I am still not clear between using a class with .(dot) character and universal class using * class. When and where should I use universal character and why should I use universal character. I can just use .(dot) and one class per html tag selector right.

1 Answer

Mike Schaming
Mike Schaming
13,925 Points

Hi Raihan! the universal selector * targets all elements on your page and applies the same style to every single element. like this:

  • { box-sizing: border-box; }

you can learn more about border-box here https://css-tricks.com/box-sizing/

A regular class is called with a . followed by the class name you assign it. ex.

.main-nav { background-color: red; }

only elements I've named in my html as class="main-nav" will be targeted.