Return the right position of a <div> element: - Javascript CSS Style Property

Javascript examples for CSS Style Property:right

Description

Return the right position of a <div> element:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<div id="myDiv" style="position:absolute;right:15px;">This is a div element.</div>

<button type="button" onclick="myFunction()">Return right position of div</button>

<script>
function myFunction() {//w w  w .  jav  a  2s  . c  om
    console.log(document.getElementById("myDiv").style.right);
}
</script>

</body>
</html>

Related Tutorials