RamseyInHouse/scut

Why does scut-center-transform add margins?

Closed this issue · 2 comments

I'm just curious, why does this mixin add auto margins (top, bottom, left and right)? It doesn't seem to change anything to the centering effect, or maybe it does in some older browsers?

I suppose it's to override any other margins that might be inherited by the element that you're using scut-center-transform on — because then it won't actually be centered.

In general, it's best to include Scut mixins first in the list of properties for a selector, and then modify the rules further by adding properties below it.

For example, scut-list-unstyled adds padding-left: 0 because its purpose is to remove any padding added by user agent (browser) stylesheets, but then you can always add your own padding values afterwards, or in a more specific selector.

So to answer your question, the added margins aren't required to make the centering work, but it does add some safeguards if someone were to use this mixin on an element with margins already defined.

Fair enough. :)