Archive for the ‘Standards’ Category

Classitis (class-eye-tiss) – The new CSS disease

Thursday, May 7th, 2009

CSS has gone through many trends and phases in web development. Certain trends are welcome, like conditional stylesheets and developers refusing to do them for Internet Explorer 6. Other trends can have leave a web application with a disadvantage for the rest of its life, yes, in-line styles, I’m looking at you.

This is all well and good, people learn from their mistakes and in the end, best practice comes out. The latest trend seems to have brought us full-circle.

About a year ago, HTML was plagued by a trend known as divitis (div-eye-tiss), a syndrome where a web page was seemingly marked up entirely in <div> tags, making a mess of the markup and producing un-readable pages. This was mainly produced by new web developers who had just moved away from the safety of table-based design and into the world of web standards and can be easily remedied with some education on elements other than <div> and <br/>.

This disease now seems to have mutated and crossed over to CSS in a trend I’m calling classitis (class-eye-tiss). It’s easy to diagnose: the first sign is in the HTML. Look closely at each element, it may have a class attached to it. If it does, does the one above have the same one? If this repeats all over the page, you may have classitis. In the navigation of your site, do all the list items have the same class name? You may have classitis. The way to tell for sure is to dive into the CSS: If the styles are predominately classes (i.e. are “.className”) with ancestor selectors being few and far between, then you have classitis.

The root cause of such a syndrome relates to modern web programming languages, notably ASP .NET. I’ll try to explain:
ASP has a number of helpful server-controlled elements which when processed turn into regular HTML elements. These all have their own unique identifier, but this is the reference for the server, not for CSS. Therefore, each of these elements can have a CSS class applied to it, and developers use this constantly. The real kicker is that ASP encourages you to use its own controls rather than standard HTML elements, making this disease especially prevalent amongst users of ASP. What makes this even worse is that ASP has been the default option for enterprise level applications for a while now, and Microsoft have made ASP accessible to new users with the Express editions of Visual Studio. It’s now easier than ever to start coding badly.

Is classitis really that bad? Well, no, but it’s what it comes with that can cause problems. A recent web site template that I was given by a company that shall remain nameless, was riddled with classisits, even so far as that there was an individual class for each font type and size. Surely setting a single class for the body would be easier and using ancestor selectors after that would provide for simpler HTML. The real problem here is maintainability: my task was to add another page which used a three-column layout rather than their two-column one. I’ve ended up duplicating their code to make my new layout fit, even then, changes made to their stylesheet won’t be reflected in my layout.

It’s a sorry state of affairs, but the remedy is simple, learn to use HTML elements properly. Some developers seem to forget that <html> and <body> are tags like all the rest and can be used to dictate the styles of the whole page. For users of frameworks like ASP, remembering that there are more elements than the ones the framework provides is very important; though don’t rely on the visual designer. Classitis is curable, and education on its prevention is important. Lets hope it’s caught before it becomes a pandemic.

It’s time to upgrade your browser, no, really

Friday, March 20th, 2009

IE 8 Logo
Internet Explorer 8 has now been unleashed upon the Windows world to a small ripple of applause and a snigger from every other browser manufacturer. It’s a big step forward for Microsoft, the IE team have put in a lot of hard work and should be proud of everything they’ve done to enforce standards on the web.

Now it’s your turn.

IE6 still accounts for 20% of all web browsing, and its even higher for corporations where policy gets in the way of letting people upgrade.  This browser is now so far behind in terms of security, speed and browsing experience that it’s not even funny, and has become a perennial headache for all web designers who want to push the Internet forward as a medium.

So, I implore you, upgrade your browser today. I’m going to do so and declare from the rooftops that I shall no longer support IE6. My web sites will be standards compliant and I will not be making any exceptions for this browser.

So, farewell IE6. It’s been a long time coming, but you’re gone.

CSS Matrix Layouts: Another Way?

Friday, March 13th, 2009

Today, Jonathan Snook posted about CSS Matrix Layouts, a proposal for a third way for creating advanced layouts in CSS3, with Advanced Layouts and Grid Layouts being the others. His ideas are around creating a grid and defining sections (be it divs or natural HTML5 elements) that are effectively laid out like a table. Each section can span like a table can span rows and columns, with all those values being stored in CSS. Take a look at the post for an example, it’s quite simple once you get your head around it.

I raised some concerns about generated columns, and how the grid might not know how to react, and also that adding columns is a bit of a headache in complex layouts, but is relatively minor compared to the benefits that it would bring. In general, there’s a lot of support for the module. Hopefully we’ll see a draft on www-style very soon.

Of course, this is just all new stuff and unlikely to be fast-tracked to CR status any time soon. However, this module is similar to the CSS Grid Layout module, and some of Snook’s work could be very useful in that module. I’m going to investigate the working draft and if it looks like I can improve it, I might even have a go.

Safari update makes itself obsolete on Windows

Wednesday, March 4th, 2009

Last week, Apple announced the Safari 4 beta with a whole host of updates and enhancements. Whilst all of this is great for Mac users, it renders the browser completely obsolete for Windows users. Let me explain:

Lets go through the list of new features.

  • Top SitesOpera first added this feature 3 years ago, Google Chrome has it, all Apple did was make it fancy and unusable
  • Cover Flow – I like the live page preview (other browsers do have that) but cover flow, to me, is something that windows users will never understand
  • Full history search – Safari is the last browser to get this function
  • Tabs on top – Google spent a lot of effort getting this right, Apple haven’t put the same level of thought into it. If anything, it makes Apple look like they’re copying Google, badly.
  • Nitro engine – Makes pages run fast. Cool
  • Native look and feel – looks good in Vista, awful in XP. Considering Vista usage is < 10%, that’s not a good thing
  • Developer tools – once again, Apple is playing catch-up

So, what does this all mean exactly? Well, Safari is becoming more and more like Chrome. In fact, all Google has to do is update their Webkit rendering engine and they will be the same browser. In this manner, Safari for Windows has just shot itself in the foot by removing any differentiating features between itself and its nearest competitior.

I fully expect Safari 5 to make itself even more like Google Chrome (whatever that may look like in 2 years time).