Helpers are classes for very targeted “one-off” local overrides. Every helper declaration uses !important and overrides everything else. They should be used as little as possible, but they’re useful for things like:
Designer’s request to “make an exception”
Quick fix until refactor
Temporary test/design
Let’s say the request is: “This component just doesn’t look right in that context, can we just increase the top and bottom padding?” You would use the spacing helper this way:
<divclass="myComponent pt-lg3 pb-lg3">
<p>Content goes here.</p>
</div>
Using helpers is optional and mCSS will work just fine without them. None of the mCSS components rely on them.
Below is a list of all the available helpers. mCSS doesn’t include every single CSS property like utility class frameworks do. It only includes the ones you actually need in those “one-off” situations. I’ve never needed more than that, but I’m open to adding anything that would be useful. Just open an issue on Github with your use case and I’ll add it in.
You can combine these properties with any dimension token as well as 0:
CSS property
Class prefix
width
w
height
h
margin
m
margin-top
mt
margin-bottom
mb
margin-left
ml
margin-right
mr
margin-inline-start
mis
margin-inline-end
mie
padding
p
padding-top
pt
padding-bottom
pb
padding-left
pl
padding-right
pr
padding-inline-start
pis
padding-inline-end
pie
Both directional sets exist on purpose. Use the logical helpers (mis, mie, pis, pie) when the spacing follows the reading direction. Use the physical helpers (ml, mr, pl, pr) when the spacing is purely visual and should stay in the same position no matter the script direction.
Same as the spacing helpers: .text-start and .text-end follow the reading direction (they flip in a right-to-left layout), .text-left and .text-right always mean the visual side.