VOOZH about

URL: https://www.geeksforgeeks.org/css/css-padding-top-property/

⇱ CSS padding-top Property - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

CSS padding-top Property

Last Updated : 28 May, 2026

The padding-top property in CSS is used to add space between the content and the top border of an element. Padding helps improve the appearance and readability of webpage elements.

  • It sets the width of the top padding area of an element.
  • Padding is the space between the content and the border.
  • The value can be specified using units like px, %, or em.

Syntax:

padding-top: length | percentage | initial | inherit;

Property Values:

  • length: This mode is used to specify the size of padding as a fixed value. The size can be set in form of px, cm etc. The default value is 0. It must be non-negative. 
  • percentage: This mode is used to set the top padding in percentage of the width of the element. It must be non-negative.
  • initial: It is used to set the padding-top property to its default value. 
  • inherit: It is used to inherit the padding-top property from its parent element.

Example: Here, we are using padding-top: length; property.

Example: Here, we are using the padding-top: percentage (%) property.

Example: Here, we use padding-top: initial; property.

Comment
Article Tags: