As we saw from the box model, padding is the space just outside the content area, and just inside the border area. In a box, there are four sides. So, we can specify paddings up to the 4 sides, plus a general padding property:
paddings can be specified in 3 ways: length, percentage, or auto. Let’s take a look at an example:
The following HTML
renders the following:
All four paddings can be specified on a single line using the “padding” property. The syntax is as follows:
padding: [padding-top] [padding-right] [padding-bottom] [padding-left]
The order is very important here. The first element is always the top padding, the second is always the right padding, the third is always the bottom padding, and the fourth is always the left padding.
Next: CSS BackgroundLink to this page: If you find this page useful, we encourage you to link to this page. Simply copy and paste the code below to your website, blog, or profile.