Do not style HTML selectors!

One of the biggest problems I face when trying to construct a maintainable web standards compliant web site is that the site often ends up being only either maintainable or compliant. The reason why it?s problematic is because web standard web sites require knowledge of many facets and disciplines from its operators. Take the average CMS user for example, the run of the mill corporate web editor. This is usually a part-time position that someone got shafted with because they spilt coffee on the boss. They?re not going to give a hoot about compliancy.

The lack of W3C knowledge is evident even understandable and expected, let’s not kick the guy when he’s down. Content Management Systems often provide solutions for users lacking the ability to create W3C compliant web pages. Enter the WYSIWYG editor.
From a sales point of view they are necessary and desirable. They denote a user-friendly web, a web for all.  A monkey could use it. That?s just a pipe dream some would say but the fact is that these CMS editing tools are a reality. WYSIWYG editors turn a simple text area into something more powerful, something that is wasn?t intended for. They?re one humongous hack that looks glitzy and may one day pretend to save your life, it’s just like watching an episode of Baywatch.

Being so powerful is all very well and good but the code they spit out isn?t consistent to say the least, never mind being W3C compliant. Some, like FCKedior, TineMCE and Xinha, do a reasonable job but still get it wrong sometimes. When writing CSS ?sometimes? just isn?t good enough. This is why I no longer write for tags that are generated by the editor. Other tags in the page that are not inputted by the user receive a higher specificity and I rely heavily on inheritance. Each template holds DIV?s with class names like ?bodytext? and ?summary? which in turn can be found in an ?article? DIV. I style the ?bodytext? DIV?s and not the markup that lies within. Nested <p> and lists and god knows what else won?t be mangled by the CSS, they?ll just be mangled.

When I started writing my stylesheets and (x)HMTL like this I noticed that I almost never styled the HTML selectors themselves other than zeroing out the margins and paddings. So as soon as I do see a rule with a HTML selector I make sure it does very little if anything at all. The web is mangled enough as it is.

Next entry: Busy busy
Previous entry: All-star team