CSS padding-top

The padding-top property in CSS is used to set the top padding of an element. Padding is the space between the content of an element and its border. You can use the padding-top property to add space above the content of an element.

The syntax for the padding-top property is:


selector {
  padding-top: value;
}

Where selector is the element you want to apply the padding to, and value can be specified in pixels, ems, rems, percentages, etc.

Let's see an example to better understand how the padding-top property works:

Result:

This is an example text with padding-top of 20px.

In the above example, we have applied a padding-top of 20 pixels to the paragraph element. This creates space above the text within the paragraph.