<div id="el" style="border-top: 1px solid blue; color: red;">
An example element
</div>
<div id="output"></div>HTMLElement: attributeStyleMap property / notebook
HTMLElement: attributeStyleMap property
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
#el {
font-size: 16px;
}
#output {
white-space: pre-line;
}const element = document.getElementById("el");
const output = document.getElementById("output");
for (const property of element.attributeStyleMap) {
output.textContent += `${property[0]} = ${property[1][0].toString()}\n`;
}