I have got a question.
How to change font-size of :root, using javascript?
I need to make a button to resize font in a whole website.
2 Answers
While I have no idea what --font-size should be, accessing :root itself seems to be working with CSSStyleSheet.insertRule()
function doThing(){
document.styleSheets[0].insertRule(':root { font-size: 26px; }');
}
HelloWord<br>
<button onclick="doThing()">Clicky</button>
bodyorhtml:root { --font-size: 16px; }