Blog Post RSS ?

Blogs » JavaScript & CSS » Essential CSS hacks
 

Essential CSS hacks

by Simon Willison

Doug Bowman: Filtering CSS. Doug introduces a brand new CSS filter, fresh from the mind of Tantek Çelik. The IE5/Mac Band Pass Filter provides a simple, reliable way of serving up a style sheet to IE5/Mac and only IE5/Mac. Armed with this filter, any IE5/Mac specific CSS bugs can be quickly and tidily negated with a browser specific work-around, safely contained in its own stylesheet.

Combine that with Tantek’s Mid Pass Filter, which does the same for all IE5 versions on Windows, and the vast majority of browshser-specific CSS problems simply go away. No more need for ugly box-model hacks and in-line workarounds for those browsers, just funnel them off to their own stylesheets and concentrate on producing standards compliant, “correct” CSS for everything else.

Don’t miss Doug’s excellent explanation of the new filter either; it’s the clearest description yet of how one of these obscure pieces of browser voodoo magic actually works.

For even more detailed coverage of CSS hack management, look no further than Molly E. Holzschlag’s latest InformIT article. Writing practical, cross-browser CSS just got a whole lot easier.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • Ping.fm
  • TwitThis

This post has 8 responses so far

  1. http://weblog.realdream.ws
    Woow, tnx a lot, i really need css hacks :)

     
  2. I cannot for the life of me understand why you would use client side filtering when it comes to CSS.

    My usual strategi involves identifying the browser by means of the excellent browscap.ini maintained by Gary Keith: http://www.garykeith.com/browsers/downloads.asp

    When doing so, I usually just test to see if the browser is Internet Explorer version “less than 6″, and if so, hand it the “IE box model stylesheet, otherwise I just hand the browser my CSS2 compliant stylesheet.

    This method can easily be used to serve many different stylesheets to many different stylesheets, or if need be, dynamically create the stylesheets on the server, based on the user-agent.

    My 2px.

    /Morgan

     
  3. Client-side vs. server-side CSS filtering is certainly something that deserves more discussion. I’ll try to post a proper entry about this some time soon.

     
  4. IMHO, I don’t agree with the “surgical connection strategy” of linking CSS sheets via another sheet. I’ve seen where Opera forgot a 3rd tier linked .css. Plus it seems one larger style sheet may compress better & perhaps be faster for the browsers’ rendering than several smaller ones.

    Morgan, you make a good point. I can go pro & con on both sides of the fence, but Simon gets first swing :)

     
  5. Personnaly, I use this hack for IE:

    And for IE 5.5:

    So, no more hack of the death that use parser bug to work :)

     
  6. I forgot, more about it here:
    http://msdn.microsoft.com/workshop/author/dhtml/overview/ccomment_ovw.asp

     
  7. FUK UR MUMS WHO EVA CUMS HERE IS GAY

     
  8. GAY

     

Sponsored Links

SitePoint Marketplace

Buy and sell Websites, templates, domain names, hosting, graphics and more.

Follow us on Twitter