CSS Padding on a given side


Example

The padding property sets the padding space on all sides of an element. The padding area is the space between the content of the element and its border. Negative values are not allowed.

You can specify a side individually:

  • padding-top
  • padding-right
  • padding-bottom
  • padding-left

The following code would add a padding of 5px to the top of the div:

<style>
.myClass {
    padding-top: 5px;
}
</style>

<div class="myClass"></div>