Difference between revisions of "CSS GUIDE PADDING"
(→Summary) |
(→Specification Conformance) |
||
(5 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
== Syntax == | == Syntax == | ||
+ | <pre>TARGET_ELEMENT {padding: value;}</pre> | ||
== Legal Values == | == Legal Values == | ||
Line 12: | Line 13: | ||
== Usage Examples == | == Usage Examples == | ||
− | h1 {padding: 10px} | + | <pre>h1 {padding: 10px} |
− | the padding will be 10px on all four sides | + | the padding will be 10px on all four sides</pre> |
− | h2 {padding: 10px 2%} | + | <pre>h2 {padding: 10px 2%;} |
− | top and bottom padding will be 10px, left and right padding will be 2% of the width of the closest element. | + | top and bottom padding will be 10px, left and right padding will be 2% of the width of the closest |
+ | element.</pre> | ||
− | h3 {padding: 10px 2% 15px} | + | <pre>h3 {padding: 10px 2% 15px;} |
− | top padding will be 10px, left and right padding will be 2% of the width of the closest element, bottom padding will be 15px | + | top padding will be 10px, left and right padding will be 2% of the width of the closest element, |
+ | bottom padding will be 15px.</pre> | ||
− | h4 {padding: 10px 2% 15px 20px} | + | <pre>h4 {padding: 10px 2% 15px 20px;} |
− | top padding will be 10px, right padding will be 2% of the width of the closest element, bottom padding will be 15px, left padding will be 20px | + | top padding will be 10px, right padding will be 2% of the width of the closest element, bottom |
+ | padding will be 15px, left padding will be 20px</pre> | ||
== Notes == | == Notes == | ||
Negative values are not allowed. | Negative values are not allowed. | ||
== Specification Conformance == | == Specification Conformance == | ||
+ | [http://www.w3.org/TR/CSS1#padding CSS 1]<br /> | ||
+ | [http://www.w3.org/TR/CSS21/box.html#propdef-padding CSS2.1] | ||
== Browser Compatibility == | == Browser Compatibility == | ||
== See Also == | == See Also == |
Latest revision as of 02:09, 12 December 2006
Contents
Summary
This property is a shorthand method of setting all of the padding properties in one declaration.
- Inherited: No
Syntax
TARGET_ELEMENT {padding: value;}
Legal Values
Values can be specified as length i.e pixels (px), centimetres (cm) or inches (in) or as a percentage (%)
Mozilla Recommended Values
Usage Examples
h1 {padding: 10px} the padding will be 10px on all four sides
h2 {padding: 10px 2%;} top and bottom padding will be 10px, left and right padding will be 2% of the width of the closest element.
h3 {padding: 10px 2% 15px;} top padding will be 10px, left and right padding will be 2% of the width of the closest element, bottom padding will be 15px.
h4 {padding: 10px 2% 15px 20px;} top padding will be 10px, right padding will be 2% of the width of the closest element, bottom padding will be 15px, left padding will be 20px
Notes
Negative values are not allowed.