Hey there, I'm wondering how to change a CSS value of the document itself, rather than targeting a specific element.
I've already looked into solutions like Change :hover CSS properties with JavaScript, but they all involve adding CSS rules. I also checked out https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle, but that seems to target specific elements as well...
What I'm looking for is a way to change a value that has been declared in the CSS file, kind of like an 'absolute value'.
One possible solution could be (for example, changing the color of the a
tag) :
var sheet = document.getStyle();
sheet.getTagStyle('a').getProperty('color').setValue('rgb(0,0,0)');
(I believe the solution must involve using https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle, but I'm struggling to understand it.)
So, is it even possible to achieve this? And if so, how can it be done? (Please note: I'm specifically looking for a solution in JavaScript, not jQuery)