DEV Community


Discussion on: My Misconceptions about the Universal Selector in CSS

justinvincent profile image
Justin Vincent

The universal selector can be very useful if you are creating a 3rd party widget for any other website to use and you don't want their css to affect you. Then you can do something like:

#my-widget > *
    position: relative !important;
    padding: 0 !important;
    margin: 0 !important;
    .. etc ..

Which can act like css reset just for the elements contained within the widget you are creating.

clairecodes profile image
Claire Parker-Jones Author

Nice, that's a really good workaround for specificity issues!