<div id="box"></div>
<div id="output"></div>DOMRectList: length property / notebook
DOMRectList: length property
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
#box {
width: 50px;
height: 20px;
border: 1px solid black;
}const box = document.getElementById("box");
const rects = box.getClientRects();
const output = document.getElementById("output");
output.textContent = `Number of rectangles: ${rects.length}`;