CSS PADDING
CSS Padding Property is used to give some space between the element content and element border. Just like margin you can provide the padding from the top, bottom, left, right, etc. You can independently apply padding on the element using separate properties. And you can also apply padding property at once by using shorthand property.
But, Padding and margin property both are different from each other. The difference between margin and padding was the margin property would have applied outside the element. But the padding property would have applied inside the element.
CSS Padding Properties
- Padding: - This property is used to set padding in one declaration.
- Padding-top: - This property is used to set padding at the top.
- Padding-right: - It is used to set the padding from the right side of the element.
- Padding-bottom: - It is used to set the padding from the bottom of the element.
- Padding-left: - This property was applied from the left side of the element.
CSS Padding Values
The Value of padding can be set in Four ways: -
- Length: - It Specifies padding in px, pt, cm etc.
- % (percentage): - It define padding in % percentages.
- Initial: - It set the padding at default values.
- Inherit: - It inherits padding from its parent elements.
Example: -
Ouput: -
Without Padding |
With Padding |