Exploring the depths of jQuery, one can effortlessly traverse the DOM. But what if we could also navigate through a stylesheet, accessing and modifying attributes for the specified styles?
Sample Stylesheet
div {
background: #FF0000;
display: block;
}
.style {
color: #00AA00;
font-family: Verdana;
}
html body > nav.menu {
list-style: none;
}
Imagine a world where we have a CSS equivalent of jQuery...
Retrieving values from CSS
$("div").attr("background");
//returns #FF0000;
$(".style").attr("color");
// returns #00AA00;
$("html body > nav.menu").attr("color");
// returns undefined;
Modifying values in CSS
$("div").attr("background", "#0000FF");
$(".style").attr("color", "#CDFF4E");
$("html body > nav.menu").attr("color", "#FFFFFF");
It may seem like wishful thinking, but hey, it's fun to dream!