Conditional CSS

2 posts, 0 answers
  1. Dan
    Dan avatar
    739 posts
    Member since:
    Mar 2009

    Posted 07 Nov 2007 Link to this post

    I fear that I'm going to get shot down in flames, but here goes.

    I'm not a big fan of trying to cram endless fudges in to a single CSS file to overcome the limitations and/or strangeness of on browser or another (in truth, usually IE) and would much rather have a nice, 'clean' set of style sheets for each browser.

    I'd like to see a skin folder with, say, a styles.css as the 'base' set of styles with, say, an ie6Styles.css and/or an ie7Styles.css and/or ...

    I don't imagine that it would be too hard to ensure that the necessary conditionals were loaded and acted upon when the various controls were rendered on to the page.

    I think that as more and more IE7 skeletons kick loose from the cupboards that they are hiding in we're going to need more and more fudges to make our RadControls work the way we want and I think that this would make such management easier in the long term.

    What do the panel think?

  2. Dimo
    Dimo avatar
    8468 posts

    Posted 07 Nov 2007 Link to this post

    Hello Stuart,

    Thank you for sharing your opinion.

    I agree that using CSS hacks for taming browsers is a bad thing, however, some other aspects of front-end development come into consideration here:

    1. Using more CSS files will lead to more HTTP requests to the server and slow down the rendering.

    2. As far as I know, Internet Explorer can handle up to 32 CSS files, so if we have a page with 10-15 RadControls and each control requires more CSS files, we are really pushing to the limit.

    3. We are in a constant process of improving the standards-compliance of our web controls and actually the number of "evil" CSS hacks used in our skins is diminishing. So having an additional CSS file for a couple of CSS rules is quite unnecessary.

    4. Introducing a practice of having multiple CSS files for different browsers will have a rather demoralizing effect on web developers (I mean all developers using our products, not just us). Instead of trying to produce a cross-browser code, they will count on their ability to feed browsers with proprietary CSS.

    5. This seems like a matter of personal taste, but in my opinion, managing one CSS file is easier than managing several ones. For example, you can put all CSS rules for a given HTML element one after another with comments and later easily gain a perspective what is going on.

    I hope you find these points reasonable.

    P.S. Concerning the IE7 skeletons, actually IE7 is a lot less troublesome than IE6, so in most cases we code for IE7+Firefox+Opera and use the "star html hack" or "underscore hack" for making IE6 behave properly.

    Sincerely yours,
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top