CSS Padding Properties

2008 Oct 17


Negative not allowed. Does not affect line-height.
Property Values Initial Value Applies to Inherited Percentage
padding [ <length> | <percentage> ] {1,4} | inherit not defined all elements no of width of containing block
padding-bottom
padding-left
padding-right
padding-top
<length> | <percentage> | inherit 0 all elements no of width of containing block

Background fills the padding region too:

CSS+HTML Results
<div style="padding: 8px; margin: 3px; 
            border: 1px dashed; 
            background: url(bg.jpg);">
<b>Why is a mouse when it spins?</b></div>
Why is a mouse when it spins?