<div id="box">
</div>
HTML
格式化
支持Emmet,输入 p 后按 Tab键试试吧!
<head> ... </head>
<body>
</body>
CSS
格式化
html {
height: 100%;
}
body {
display: flex;
align-items: center;
height: 100%;
justify-content: center;
}
#box {
width: 100px;
height: 100px;
background: #ced;
border: 5px solid #eee;
margin: 10px;
padding: 10px
}
JS
格式化
const box = document.getElementById("box");
console.log(box.scrollHeight)
// console.log(box.clientHeight)
// console.log(box.offsetHeight)
// console.log(box.getBoundingClientRect().toJSON())