CSS/Properties/padding-top

From W3C Wiki
Jump to: navigation, search

padding-top

The padding-top property sets the top padding of a box.

Description

Values <padding-width> | inherit
Initial value 0
Applies to all elements except table-row-group, table-header-group, table-footer-group, table-row, table-column-group and table-column
Inherited No


Values

  • <length>


  • <percentage>


  • inherit
    Takes the same specified value as the property for the element's parent.


Example

Example A

[style.css]

 #body{
   background-color: #666;
 }
 p{
   background-color: #ccc;
 }
 #pad{
   padding-top: 50px;
   padding-right: 10px;
   padding-bottom: 50px;
   padding-left: 10px;
 }

[index.html]

<body>
  <p>This is a paragraph</p>
  <p id="pad">This is a paragraph</p>
  <p>This is a paragraph</p>
  <p>This is a paragraph</p>
</body>

Csslist2 padding.png

CSS Reference

The CSS specification defines the padding-top property in 8.4 Padding properties.

See also