Documentation
CSS Shorthand
Shorthand properties are CSS properties that let you set the values of multiple other CSS properties simultaneously. Using a shorthand property, you can write more concise (and often more readable) style sheets, saving time and energy.*
Margin
Margin should be coded as shorthand when top, right, bottom and left are declared, reference Margin Properties. When an ePub is exported from InDesign the CSS will not be in the shorthand format, example:
css1.foo {2margin-bottom: 0;3margin-left: 0;4margin-right: 0;5margin-top: 0;6}
This can be converted with regex:
bash1## Find2margin-bottom:([0-9.]{1,5})(px|em|);\s+margin-left:([0-9.]{1,5})(px|em|);\s+margin-right:([0-9.]{1,5})(px|em|);\s+margin-top:([0-9.]{1,5})(px|em|);3## Replace4margin:\7\8 \5\6 \1\2 \3\4;
Padding
Padding should be coded as shorthand, reference Padding Properties.
Border
InDesign CSS for a table by default lists everything out and if no variation to width, style or color exists than it should be coded in shorthand:
css1.table .foo td {2border-left-width: 1px;3border-left-style: solid;4border-left-color: #000000;5border-top-width: 1px;6border-top-style: solid;7border-top-color: #000000;8border-right-width: 1px;9border-right-style: solid;10border-right-color: #000000;11border-bottom-width: 1px;12border-bottom-style: solid;13border-bottom-color: #000000;14}
shorthand:
css1.table .foo td {2border: 1px solid #000000;3}