Separating behavior

The modern understanding of a web page is that it consists of three distinct parts:

  1. Content (HTML)
  2. Presentation (CSS)
  3. Behavior (JavaScript)

These should be kept separate, ideally each in its own file (or files). What it means for JavaScript is that there should be no inline such as onclick, onmouseover, etc. Ideally there should be little to no inline scripts.

The idea is that content (the text on the page) is independent of:

  • how it looks like, so the page should be usable even with CSS disabled, or not supported by the browser, and
  • how it behaves, meaning the page should be usable even with JavaScript disabled. The content should be accessible independent of any mouseovers, animations, and so on.

Tags: ,

Sorry, comments disabled and hidden due to excessive spam. Working on restoring the existing comments...

Meanwhile you can find me on twitter - @stoyanstefanov