CSS Padding
The CSS padding property is used to create space around an element's content, inside the border. It can be applied to any HTML element, such as div, p, span, etc.
The padding property can be set using different units such as pixels, percentages, ems, etc. Padding can be applied to all four sides of an element (top, right, bottom, left) or individually.
Example 1: Applying padding to all sides equally
div {
padding: 20px;
}
This is a div element with padding applied to all sides equally.
Example 2: Applying padding to individual sides
p {
padding-top: 10px;
padding-right: 20px;
padding-bottom: 10px;
padding-left: 20px;
}
This is a paragraph element with padding applied to individual sides.