CSS Padding refers to the space between the content of an HTML element and its border. Padding can be used to add space and improve the readability and aesthetics of an element.
Padding can be specified using the CSS padding property, which accepts up to four values. The values can be specified in pixels, ems, rems, or percentages. The syntax for the padding property is as follows:
padding: top right bottom left;
Where “top”, “right”, “bottom”, and “left” refer to the padding values for each side of the element. If only one value is specified, it applies to all four sides. If two values are specified, the first applies to the top and bottom, and the second applies to the left and right. If three values are specified, the first applies to the top, the second applies to the left and right, and the third applies to the bottom.
For example, to add 10 pixels of padding to all sides of an element, you could use the following CSS rule:
Or, to add different padding values for each side of the element, you could use the following rule:
padding: 10px 20px 30px 40px;
This would add 10 pixels of padding to the top, 20 pixels to the right, 30 pixels to the bottom, and 40 pixels to the left of the element.
Leave A Comment