CSS padding is the space between an HTML element’s content and its border. It is used to create space around the content of an element and can be set using the padding property in CSS. The padding property can take one or four values, which represent the padding for the top, right, bottom, and left of an element, respectively. The values can be set in pixels, em, or other units of measurement. The padding can also be set individually for each side of the element using the properties padding-top, padding-right, padding-bottom, and padding-left.
When one value is set, it applies to all four sides of the element.
When two values are set, the first value applies to the top and bottom, and the second value applies to the left and right.
When three values are set, the first value applies to the top, the second value applies to the left and right, and the third value applies to the bottom.
When four values are set, the values apply to the top, right, bottom, and left in that order.
For example, padding: 10px; sets a 10px padding on all four sides of the element, while padding: 10px 20px; sets a 10px padding on the top and bottom, and a 20px padding on the left and right.