MDN self-hosted library · e01.org

CSSStyleDeclaration: length property

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

html
<div
  id="div1"
  style="margin: 0 10px; background-color: #ccaa11; font-family: monospace"></div>
js
const myDiv = document.getElementById("div1");
const divStyle = myDiv.style;
const len = divStyle.length; // 6