Get the width of the left border of a <div> element: - Javascript CSS Style Property

Javascript examples for CSS Style Property:borderLeftWidth

Description

Get the width of the left border of a <div> element:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<div id="myDiv" style="border-left:thick solid red">This is a div element.</div>
<br>
<button type="button" onclick="myFunction()">Return the width of the left border</button>

<script>
function myFunction() {/*from w ww.ja  v  a 2s  .c  o  m*/
    console.log(document.getElementById("myDiv").style.borderLeftWidth);
}
</script>

</body>
</html>

Related Tutorials