Style paddingBottom Property
Example
Set the bottom padding of a <div> element:
document.getElementById("myDiv").style.paddingBottom = "50px";
Try it Yourself »
Description
The paddingBottom property sets or returns the bottom padding of an element.
Both the margin property and the padding property insert space around an element. However, the difference is that margin inserts the space around the border, while padding inserts the space within the border of an element.
Browser Support
Property | |||||
---|---|---|---|---|---|
paddingBottom | Yes | Yes | Yes | Yes | Yes |
Syntax
Return the paddingBottom property:
object.style.paddingBottom
Set the paddingBottom property:
object.style.paddingBottom = "%|length|initial|inherit"
Property Values
Value | Description |
---|---|
% | Defines the bottom padding in % of the width of the parent element |
length | Defines the bottom padding in length units |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Technical Details
Default Value: | 0 |
---|---|
Return Value: | A String, representing the bottom padding of an element |
CSS Version | CSS1 |
More Examples
Example
Change the bottom padding of a <div> element back to "normal":
document.getElementById("myDiv").style.paddingBottom = "0px";
Try it Yourself »
Example
Return the bottom padding of a <div> element:
alert(document.getElementById("myDiv").style.paddingBottom);
Try it Yourself »
Example
Difference between marginBottom and paddingBottom:
function changeMargin() {
document.getElementById("myDiv").style.marginBottom = "100px";
}
function changePadding() {
document.getElementById("myDiv2").style.paddingBottom = "100px";
}
Try it Yourself »
Related Pages
CSS tutorial: CSS Padding
CSS reference: padding-bottom property
HTML DOM reference: padding property
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.