Can we define min-margin
and max-margin
, max-padding
and min-padding
in CSS ?
Late to the party, but I'd like to share my simple solution.
I'm gonna assume that if we want something that would work like a min-margin, it's because we have a margin: auto;
in the first place, and we don't want that margin auto being smaller than a certain number.
We can do that with two div
, one inside another.
Here is an example with horizontal margins.
Lorem Ipsum etc
As for the css:
.margin-auto {
margin: 0 auto;
}
.min-margin {
margin: 0 16px;
max-width: 300px;
}