/

HTML / CSS / JavaScript Tutorial

CSS Property: padding-bottom

[this page | pdf | back links]

The CSS (CSS1) padding-bottom property sets the width of the bottom padding (space) of an element.

 

Valid property values (other than inherit and initial) are:

 

Value

Description

length

Any specified thickness as a CSS length

%

As percentage of width of containing element

 

Default Value:

0

JavaScript syntax:

e.g. object.style.paddingBottom="4px"

Inherited:

No

Animatable:

Yes

 

EXAMPLE:


HTML USED IN THIS EXAMPLE:
<!DOCTYPE html>
<html> <!-- Copyright (c) Nematrian Limited 2018 -->
<head>
<style>
div {border: 2px solid red; width: 100px; background-color: yellow}
span {border: 2px solid green; background-color: aqua;}
.x1 {padding-bottom: 5px;}
</style>
</head>
<body>
1. Element with default property<br>
<div><span>1</span></div><br><br>
2. Element set using in-file HTML style<br>
<div><span class="x1">2</span></div><br><br>
3. Element set using JavaScript<br>
<div><span id="x2">3</span></div>

<script>
document.getElementById("x2").style.backgroundColor = "aqua";
document.getElementById("x2").style.paddingBottom = "5px";
</script>

</body>
</html>

FUNCTION THAT MAY ASSIST IN TESTING WHETHER FEATURE IS SUPPORTED:
function isSupportedCSSPropertyPaddingBottom() {
  var x = document.createElement("DIV"); x.style.paddingBottom = "5px"; return (window.getComputedStyle(x, null).paddingBottom == "5px");
}


NAVIGATION LINKS
Contents | Prev | Next | CSS Properties


Desktop view | Switch to Mobile