DEV Community

loading...

Discussion on: CSS adding margin to all children

Collapse
nikolab profile image
Nikola Betica

Hi. I think you should drop !important rule. Like this, it will override any other margins on any child element and that is probably not what you want. Good idea though, cheers.

Collapse
mnishiguchi profile image
Masatoshi Nishiguchi Author

Hmm, I tried to understand what you meant but I couldn't. When I use this utility class, I want it to be applied on all child elements. Overriding is fine if there is.

Collapse
nikolab profile image
Nikola Betica

Ok, if that's what you need. It just seem to me you should override styles with selector specificity rather than important. Important should be used as a last case scenario or a quick fix, not a permanent solution.