DEV Community

Discussion on: 5 Quick facts on Universal Selector

 
shahab570 profile image
Md Shahab Uddin • Edited

It's not compulsory to put id/class at the end of the selector. It is better to style elements in this way as much as possible because browser checks the rightmost selector first. So being specific is crucial.

The browser checks the rightmost selector first before moving left.
Therefore, when writing selectors, it's best to put something performant like a class or ID at the end.