Can I give each side of my content different padding?


#1

Question

Can I give each side of my content different padding?

Answer

Sure can! We can give each side of our content different padding with the padding-top, padding-right, padding-bottom, and padding-left properties, for example:

padding-top: 10px; /*will set padding-top to 10px*/
padding-right: 2rem; /*will set padding-right to 2rem*/
padding-bottom: 1em; /*will set padding-bottom to 1em*/
padding-left: 5px; /*will set padding-left to 5px*/

Or we can set padding values for each side using the shorthand notation:

padding: 10px 2rem 1em 5px; /*will set padding-top to 10px, padding-right to 2rem, padding-bottom to 1em, and padding-left to 5px*/