function getStyleSheet(uniqueTitle) {
for (const sheet of document.styleSheets) {
if (sheet.title === uniqueTitle) {
return sheet;
}
}
}Document: styleSheets property / notebook
Document: styleSheets property
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
for (const styleSheet of document.styleSheets) {
for (const rule of styleSheet.cssRules) {
console.log(`${rule.selectorText}\n`);
}
}body {
background-color: darkblue;
}
p {
font-family: "Arial";
font-size: 10pt;
margin-left: 0.125in;
}
#lumpy {
display: none;
}