<!DOCTYPE html>
<html>
<head>
<style>
#divid {
height: 200px;
width: 250px;
padding: 10px;
margin: 15px;
border: 3px solid blue;
}
</style>
</head>
<body>
<div id="divid">
<p>javascript programming</p>
</div>
<button onclick="GetWidthHeight()">Click To get width and height</button>
<script>
function GetWidthHeight() {
let element = document.getElementById("divid");
let width = "Width: " + element.offsetHeight + "px";
let height = "Height: " + element.offsetWidth + "px";
console.log(width);
console.log(height);
}
</script>
</body>
</html>
<!--
run:
"Width: 226px"
"Height: 276px"
-->