<div
id="div1"
style="margin: 0 10px; background-color: #ccaa11; font-family: monospace"></div>CSSStyleDeclaration: length property / notebook
CSSStyleDeclaration: length property
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
const myDiv = document.getElementById("div1");
const divStyle = myDiv.style;
const len = divStyle.length; // 6