CSS Padding to push content away from borders

CSS

Created: 2022-10-03


The padding CSS shorthand property sets the padding area on all four sides of an element at once.

/* Apply to all four sides */
padding: 1em;

/* vertical | horizontal */
padding: 5% 10%;

/* top | horizontal | bottom */
padding: 1em 2em 2em;

/* top | right | bottom | left */
padding: 5px 1em 0 2em;