This is currently not possible, unfortunately. You will have to stick with the appropriate margin-top and margin-bottom respectively.
A shorthand property always changes the values of all its components (longhand). Namely, any values omitted in the abbreviated property will be initial by default for their respective properties, unless cascading or other rules are allowed depending on the shorthand property. For example, the following results in an automatic field on all sides except the bottom due to margin-bottom longhand, which appears after the reduction:
#header { margin: auto; margin-bottom: 1em; }
If there were separate abbreviations for horizontal fields and vertical fields, you could do this without worrying about saving certain lengths, but such abbreviations do not exist at the moment.
As I mentioned in my comment, margin: 1em inherit not valid because CSS inherit (along with initial and others presented in later standards) can only be displayed by themselves in property declarations, and this includes declining declarations. Even if margin: 1em inherit really worked, the element would inherit horizontal fields from its parent element, and not from its own cascade (since this is not what inheritance means). It is impossible to get a cascading or set value for a property for a given element, and the ability to do so will almost certainly be error prone because the lowest declaration from the most specific selector containing the allowed value can be anywhere.
Boltclock
source share