Understanding and solving the JavaScript/CSS entanglement phenomenon
Written by on February 16th, 2007 in Ajax News.
Ara Pehlivanian talked about the graceful degradation myth awhile back, and since then has come up with a simple solution to his problem.
The key is setting CSS styles aimed at JS enabled browsers that overwrite the initial state in the document that does the right thing for someone who isn’t coming in via a JavaScript enabled environment (e.g. accessible).
Here is an example of a window that drops down content in JS mode, and shows it without thus not blocking that content from non-JS view.
The CSS
Brand CSS for items that you want to override via hasJS classnames.
-
-
body.hasJS {
-
background-color: #0f0;
-
}
-
-
body {
-
background: #f00;
-
}
-
JavaScript
Turn on that CSS via JavaScript (addClassName):
Do you use these tactics?
Source: Ajaxian
Original Article: http://ajaxian.com/archives/understanding-and-solving-the-javascriptcss-entanglement-phenomenon