Pig Work

Pig Work skip to main content

Weblog of Freelance Designer Steven Clark


Content, Presentation and Behaviour

Filed under: — 11:21 am

Lately I’ve been more and more impressed with the industry best practise of attempting as far as possible to separate my (X)HTML, CSS and JavaScript files so they don’t intermingle. Well I’ve always done that with my markup and CSS but I’m only more recently aware of the benefits of Unobtrusive JavaScript and the negatives of having junk code throughout my documents.

By separation I mean keeping all of your CSS in external stylesheets and all of your JavaScript in external files as well. The benefit of this approach is that your work is more modular and you can simply point to a new external CSS file for a redesign of the look and feel of a site, or quite simply create a new external JavaScript file to change behaviours sitewide. This means that you don’t have to troll every page in every directory looking for instances that need updating when you go to change presentation and behaviours which would be especially irritating (and expensive to a client) on a 10,000 page site. Likewise, keeping your content pure makes for easier and cheaper maintenance as well as lighter pages that are more efficiently indexed. So its a win / win.

While using inline styles and JavaScript is perfectly legitimate, it’ll validate and nobody will rake your bare butt on hot tarmac, the industry best practise is generally accepted to be the separation of content, presentation and behaviour.

Comments »

The URI to TrackBack this entry is: http://pigwork.info/wp-trackback.php/93

No comments yet.

RSS feed for comments on this post.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>