实例一:
CSS:
p {padding: 15px; border: 1px solid black; }
h5{padding: 0px; border: 1px solid red;}
XHTML:
This is a paragraph that has a padding of 15 pixels on every side: top, right, bottom, and left.
实例二:
CSS:
p {padding: 2%; border: 1px solid black; }
h5{padding: 0px; border: 1px solid red;}
XHTML:
This is a paragraph that has a padding of 5 pixels on every side: left, top, right, and bottom.
实例三:
CSS:
p { padding-left: 5px; border: 1px solid black; }
h5{
padding-top: 0px;
padding-right: 2px;
padding-bottom: 13px;
padding-left: 21px;
border: 1px solid red;
}
XHTML:
This paragraph had one padding specified(left), using directional declaration.
实例四:
CSS:
p {
padding: 5px 15px;
border: 1px solid black;
}
h5{
padding: 0px 5px 10px 3px;
border: 1px solid red;
}
XHTML:
This paragraph has a top and bottom padding of 5 pixels and a right and left padding of 15 pixels.