1. Jun 29th, 2008

    CSS Sucked my Soul

    Turns out some of the float annoyances I recently experienced are easily fixed. All it took was a quick read through Anthony Short’s How to get Cross Browser Compatibility Every Time. As a rule of thumb remember to always overflow:auto your containers:

    It seems that reminding the outer DIV that it’s overflow is set to ‘auto’, forces it to think “oh yeah.. I’m wrapping that thing, aren’t I?”.

    Sheesh.

    In more complex layouts, you’ll still have to solve the ”float drop” problem. Have a look at Faux Absolute Positioning. Interesting use of left: 100% and margin-left: -100%.

    We’re not done yet. You obviously want the important content to come first in the HTML, followed by sidebars and everything else. But also for the content to appear right of the sidebar, or in-between two sidebars. Main content up front in your HTML, besides being a supposedly SEO-friendly technique also reads much better on crappy cell phone browsers. Or for that matter any browser when you’re off WiFi and into spotty cell coverage territory.

    To the rescue, Matthew James Taylor’s Perfect 3 Column Liquid Layout.

    Calendar says its 2008, and we still don’t have an easy way to say ”this section goes on the left column, that section is the right column. ktnxbye”

    That’s all for today’s edition of CSS Sucked my Soul. Tune in next time when we explain what it takes to center an element.

    1. Jul 4th, 2008

      Jos Hirth

      It’s really great how even the most simple things (those CSS was invented for) feel like a hack. Everything is done indirectly through a needle’s eye. Everything would be easier with a proper programming language for this task. And more importantly the required time wouldn’t be completely random.

      Additionally, the correctness of the implementation would be easier to verify.

      I really hate the mess CSS currently is. I really really do. There are a dozen /creative/ techniques to do the very same thing… and all of those fail in different obscure ways. Who wants something like that?

      I’d rather write two times as much (in a sane programming language) as the perfect solution with CSS would be. Simply because actually doing that on the first try never seems to happen in reality. I usually have to redo pieces over and over again. Sometimes I’m forced to add extra markup etc. A /massive/ rather complicated specification really isn’t doing anyone any good.

      And then there is that damage amplifier called Internet Explorer. Bah! :v

    Your comment, here ⇓