// thinkbeforecoding

CSS is too Tricky

2008-11-25T15:47:49 / jeremie chassaing

I found through Alvin Ashcraft's Morning Dew a post about CSS tricks Six indispensable CSS tips and tricks I use on every project. Very interesting since it gives some ways to make cleaner CSS integration (I really like the Overclear one, don't need the clear both anymore !!).

But while reading this question came to my mind:

Why do we need to find crazy tricks like this for any single thing we want to do with HTML + CSS ?

This is the sign that HTML + CSS is a complete design failure !

When you want to make something as simple as putting several blocks on the same line... you must use float left, but it does not behave exactly has you expect it to do... When using Silvelight and WPF I had none of these problems. There are surely other problems with theses technologies but I have found an important difference :

  • In CSS, the elements decide how the fit in their parent
  • In Silverlight, parents decide the layout of their children

And it makes a huge difference. Because in CSS, the interactions between sibling children using very different placement models make it a n*n combination problem. For sure it's not manageable and no browser can handle every case gracefully.

In Silverlight, you obtain the layout you want by composition, and each rule remains simple. No need to use Jedi tricks to obtain what you want.