Using negative values to Set the bottom position of a <div> element: - Javascript CSS Style Property

Javascript examples for CSS Style Property:bottom

Description

Using negative values to Set the bottom position of a <div> element:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<style>
#myDiv {/*w  w  w. j  a  v a  2  s  . c om*/
    border: 1px solid #FF0000;
    position: relative;
}
</style>
</head>
<body>

<div id="myDiv">This is a div element.</div>
<br>

<button type="button" onclick="myFunction()">Set bottom position of div to -100 px</button>

<script>
function myFunction() {
    document.getElementById("myDiv").style.bottom = "-100px";
}
</script>

</body>
</html>

Related Tutorials