I do not know how to access a specific CSS using javascript.
Let us say,
#menu { color: red; }
can be accessed by
document.getElementById('menu').style.color = "blue";
But I want to access
#menu li a { height: 10%; }
How do I access that using document.getElementById() ?
Plain JavaScript solution:
You cannot use
getElementById()in this case since its purpose is only to query id attributes, but you can usegetElementsByTagName()in context of#menu:jQuery Solution:
If you are able to use jQuery, this becomes exceedingly simpler: