Property consolidation


“Set the top and bottom padding of h2 elements to 20 pixels and set the left and right padding of h2 elements to 30 pixels.”

Is there a way to consolidate the top/bottom and the left/right so I don’t have to type out 30px and 20px twice?


No short-hand exists to combine all of these values. These are all different properties, unlike, background , which has colors, images, positions and repeat instructions and as such can be squashed into a short-hand form.


Nevermind. I got it.


actually, there is a shorthand. Full out it would be:

padding: 20px 30px 20px 30px;

with the shorthand you only have to write 20px once and 30px once. So that qualifies as shorthand, good you found it @lpdiddy5


You are asking for this @lpdiddy5 ?

padding: 20px 30px;

top/bottom - 20px
right/left - 30px


yes, he was, but he already figured it out:


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.