Style bottomProperty
Style Object
Definition and Usage
The bottom property sets or returns the bottom position of a positioned element.
This property specifies the bottom position of the element, including: padding, scrollbar, border, and margin.
Tip:A positioned element is an element whose position property is set to: relative, absolute, or fixed.
Syntax
Set the bottom property:
Object.style.bottom="auto|length|%|inherit"
Return the bottom property:
Object.style.bottom
| Value | Description |
|---|---|
| auto | Default. The browser calculates the bottom position. |
| length | Sets the bottom edge of the element to a position relative to the bottom edge of the nearest positioned parent element, using units such as px, cm, etc. Negative values can be used. |
| % | Sets the bottom edge of the element to a percentage position relative to the bottom edge of the nearest positioned parent element. |
| inherit | The value of the bottom property is inherited from the parent element. |
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the bottom property.
Note:IE7 and earlier versions do not support the "inherit" value. IE8 only supports "inherit" if a !DOCTYPE is specified. IE9 supports "inherit".
Examples
Examples
Set the bottom position of a button:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Example Tutorial (example.com)</title>
<style type="text/css">
#b1{
position:absolute;
}
</style>
<script>
function displayResult(){
document.getElementById("b1").style.bottom="100px";
}
</script>
</head>
<body>
<input type="button" id="b1" onclick="displayResult()" value="Set the bottom position">
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>Example Tutorial (example.com)</title>
<style type="text/css">
#b1{
position:absolute;
}
</style>
<script>
function displayResult(){
document.getElementById("b1").style.bottom="100px";
}
</script>
</head>
<body>
<input type="button" id="b1" onclick="displayResult()" value="Set the bottom position">
</body>
</html>
Try it Yourself »
Style Object Other Extensions