Valid CSS Is Irrelevant

November 12, 2006

Someone recently posted on the css-d list (a useful place to learn more about practical CSS) a very ugly hack which proudly announced at the end “this hack is valid CSS3″. Well, great. Does that mean that whatever flaw in the target browser (in this case Safari) the hack was used to work around will bring other browsers to their knees when they catch up in CSS support? Not a great approach to web site building.

I am not anti-hack. Recently I resorted to an amazing filter: hack to get around an inheritance bug in IE6, and I use * html in pretty much every stylesheet I write. But normally I am compensating for some major lack of support in the still-unfortunately-widespread IE6 that other contemporary browsers have (eg no min-height). I think hacking for leading-edge browsers is a bad idea, and try to confine myself to hacks that can do no harm in the future (I don’t use the underscore hack, but it’s a safe one, as it’s unlikely new browsers will suddenly start supporting it.)

And as for “valid CSS” – I could care less. zoom:? filter:? Ok, if it works. Valid HTML - yes, please. That’s future-proofing. But isn’t CSS where we shunt all the complexity and ugliness that used to be in the markup? One day there may be an elegant and easy-to-understand layout language, but sadly CSS ain’t it.

In my view, as developers we are custodians of the information entrusted to us. In trying to make it appear on screen as intended we should add as little cruft to the markup as possible to achieve the desired look and feel. CSS and Javascript are tools to add visual appeal and functionality to the basic information. These need to be future-proofed too, of course, but we must accept that they are of secondary importance and some day they may be superceded.

Aiming for valid CSS is fine, and won’t it be nice when it’s all we need? But we mustn’t fool ourselves into thinking that if it validates we can’t have done anything wrong.

11 Comments »

The URI to TrackBack this entry is: http://frontend.blogsome.com/2006/11/12/valid-css-is-irrelevant/trackback/

  1. I totally agree with this, when I code my sites I work by the rule: If you need to hack the css then you’ve coded it wrong.

    When I design sites I design with all browsers in mind so I won’t need to hack the css.

    Comment by Keith — November 13, 2006 @ 1:00 pm

  2. Valid CSS works fine in EVERY common browser, IE6 included. Microsoft provided the conditional comments functionality precisely so you don’t need to hack your CSS to make IE-only adjustments using perfectly-valid CSS. A few lines of conditional comments included into HTML is not “cruft”.

    Comment by David — November 13, 2006 @ 10:26 pm

  3. David, if only it were just the ugly comment lines in the head of every document on your site. That, for me, would be enough reason not to use them, but there’s also the extra complexity in debugging and maintaining extra IE-specific stylesheets.

    Do you break your main stylesheet into smaller components? If you do, do you have a separate hacked stylesheet for each component? Aargh!

    Organizing CSS is difficult, but important. Me, I prefer to keep my IE hacks close to the standards code that works on the same area of the page.

    Comment by frontend — April 13, 2007 @ 12:33 pm

  4. In which country do you live? :)

    Comment by browser firefox — March 20, 2008 @ 8:48 pm

  5. CSS “Cascading Style Sheets” Lessons
    css list style Properties and examples — http://css-lessons.ucoz.com/list-css-examples.htm

    Comment by Saç Dökülmesi Bakımı — August 11, 2008 @ 8:35 pm

  6. Very good blog post. I definitely appreciate this
    site. Thanks!

    Comment by dyson dc41 animal — December 6, 2012 @ 1:54 am

  7. Grеat аrticle! Тhаt is the type of information
    that ѕhoulԁ be sharеd across thе
    net. Shame οn Gοοglе fοг nо lоngeг ρoѕitionіng thiѕ submіt uρper!
    Cοmе оn over and discuss with mу ωеbsitе .
    Thanks =)

    Comment by Karry — December 10, 2012 @ 7:22 am

  8. Αttгасtіvе sectiоn οf сontent.
    I just ѕtumbled upon youг sіte and in аcceѕsіon
    сapital to аѕѕert thаt I acquiгe in fact loved account youг blog posts.

    Anуway I’ll be subscribing in your augment and even I achievement you get right of entry to constantly rapidly.

    Here is my web blog: how To Earn money

    Comment by how To Earn money — December 10, 2012 @ 10:32 am

  9. Ηellο, this weekend is nice in favor of me, ѕince this time i am rеadіng this wonderful infoгmatiνe aгticle here at my home.

    Comment by gold coast window cleaners — December 11, 2012 @ 2:07 am

  10. Hello it’s me, I am also visiting this web page on a regular basis, this web page is actually pleasant and the people are really sharing fastidious thoughts.

    Comment by healthy bread in five minutes a day — April 17, 2013 @ 4:51 am

  11. I laughed at srvaeel parts of your article, it was very well written and funny! I do have to say, though, that I think women are worse about their own appearance than men, because we’re constantly told and shown what perfection is, and that we have to be that if we want to get or keep a guy, while guys don’t have as much of that directed towards them. I’ve been told my whole life that unless I am a pro chef, impossibly gorgeous, with no blemishes or unnecessary hair, that I am going to never be able to get a guy. This can be murder on self-esteem, which leads to the whole female competitiveness thing. Luckily I dodged most of that crap, what with the whole me not caring what anyone thinks thing.Anyway, really good article, I loved reading it!

    Comment by Yonny — May 22, 2013 @ 9:27 am

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=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>



Anti-spam measure: please retype the above text into the box provided.

Get free blog up and running in minutes with Blogsome | Theme designs available here