Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Target IE6 and IE7 with only 1 extra character in your CSS (briancray.com)
36 points by JournalistHack on July 25, 2009 | hide | past | favorite | 7 comments


I've never been a big fan of these sort of hacks. Conditional comments work fine and I don't mind the extra request on the part of the users who choose to use an inferior browser. I'd rather have my IE users load more data than have everyone load more data.


So now, if I understand this correctly, we get to mix all the special treatment for IE6 in one messy stylesheet instead of keeping them in a separate one where we can jut throw them out all at once when that thing has died off? I don't think so.


I have to mantain a 1000-line CSS for a social network. I use this specific hack always followed by /* IE6* / , and only on cases of rendering discrepances (for example: checkboxes in IE6 have additional padding). I always try to solve rendering differences by altering the markup, not hacking my way in CSS, but there are a few cases where this is necessary.

This setup brings me these benefits:

* I can see at a glance where a particular attribute is tailored to IE6.

* When I have a problem with IE6, I just Inspect the suspicious element with Firebug on Firefox and look at the stylesheet. No need to open a different file and find the selector there.

* When this awful program dies, I'll just scan the file and delete all occurences of /* IE6* / (not many).

(Sorry about my broken English, it's not my first language) EDIT: Formatting -- my first time here :)


I don't validate my CSS and could care less if there were a hack or two in them. But I use conditional comments because I find it more easier to maintain and debug IE's garbage than using embedded hacks. If I wanted to save on HTTP requests, I'd look at other things that most users would be hitting (images, scripts) than one or two files that only some users with inferior browsers would hit.

If the everything-in-one-stylesheet route works for you and you know what you're getting into, power to you. But don't start asserting that those who use conditional comments are wasting their time and clients money solely for some CSS zen bullshit. That's just a silly accusation...


When i look at conditional comments, I at least feel comfortable knowing that everything is plainly laid out, And looks cleanly formatted enough for me to be comfortable.

Slapping these one star hacks into my css everywhere would start to look very very messy.


Validating css (or html, rss for that matter) is a bit more than idealistic bullshit. It is testability and professionalism.


Specifying per-browser CSS is hardly the problem.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: