HTML and CSS Reference
In-Depth Information
Building A Relationship Between CSS &
JavaScript
BY TIM WRIGHT
jQuery, Prototype, Node.js, Backbone.js, Mustache and thousands of JavaScript microlibraries
all combine into a single undeniable fact: JavaScript is popular . It's so popular, in fact, that
we often find ourselves using it in places where another solution might be better in the long
run.
Even though we keep JavaScript, CSS and HTML in different files, the concepts behind
progressive enhancement are getting all knotted up with every jQuery plugin we use and with
every weird technique that crops up. Because JavaScript is so powerful, there are a lot of
overlaps in capability between JavaScript and HTML (building document structure) and
JavaScript and CSS (injecting style information). I'm not here to pick on any JavaScript library,
bootstrap or boilerplate; I'm just here to offer a little perspective as to where we are and how
we can realign our goals.
Image Credit: opensourceway 1
Keeping CSS Out Of Your JavaScript
CSS can hook into HTML with a variety of different selectors; this isn't anything new. By using
IDs, classes or any attribute you can think of (even custom attributes), you have easy access
Search WWH ::




Custom Search