Is there a way to specify a CSS property is skipped in the shorthand, with padding, border, margin, etc.
Like padding: <skipped> 1em 2em
instead of:
padding-right: 1em
padding-bottom: 2em
Is there a way to specify a CSS property is skipped in the shorthand, with padding, border, margin, etc.
Like padding: <skipped> 1em 2em
instead of:
padding-right: 1em
padding-bottom: 2em
I think your best bet is to assign the value auto
though that will only set it to any default [browser] value it may have, I'm guessing that for padding it will reset it to 0 [depending on the element].
Other than that, no.
The correct way to skip properties is to not use shorthand:
padding-bottom: 2em;
padding-right: 1em;
It's not as elegant as:
padding: same 1em 2em same;
but it simply doesn't exist in pure CSS. If you use server-side CSS extensions such as LESS or SASS, there may be syntax to do that; if there isn't, it could be added with relative ease.
padding-right: 1em; padding-bottom: 2em
is really the only way. –
Canaan padding: same 1em 2em same;
to padding-bottom: 2em; padding-right: 1em;
, just like they convert .foo { .bar {...} .baz {...} }
to .foo .bar {...}
.foo .baz {...}
–
Sauers padding-left
). –
Mortgagor same 1em 2em
. The same
on the end is already unnecessary by the existing CSS convention. –
Mortgagor padding: 1em 2em 3em;
is the same as padding-top: 1em; padding-left: 2em; padding-right: 2em; padding-bottom: 3em;
It reuses the second value for the left and right sides, which is different than leaving them alone. –
Sauers auto
and inherit
are obviously taken). Some of the thoughts I had were as-is
, same
, ~
, =
, @
and prev
. If anyone does go on to add this feature to a gitrepo, take care to choose the best keyword. –
Sauers I think your best bet is to assign the value auto
though that will only set it to any default [browser] value it may have, I'm guessing that for padding it will reset it to 0 [depending on the element].
Other than that, no.
© 2022 - 2024 — McMap. All rights reserved.