Style Sheets
  Home arrow Style Sheets arrow Cross Browser Issues: CSS Hacks Explained,...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
STYLE SHEETS

Cross Browser Issues: CSS Hacks Explained, Tips, Tricks and Fixes
By: Jennifer Sullivan Cassidy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 20
    2006-01-25

    Table of Contents:
  • Cross Browser Issues: CSS Hacks Explained, Tips, Tricks and Fixes
  • The Use of JavaScript and CSS
  • Hiding CSS from Buggy Browsers
  • Workarounds for Internet Explorer
  • More Workarounds for Internet Explorer

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Cross Browser Issues: CSS Hacks Explained, Tips, Tricks and Fixes


    (Page 1 of 5 )

    Anyone who creates Cascading Style Sheets knows that Internet Explorer is a headache of a browser to build for because of the way it handles CSS. In this article, Jennifer goes into detail about how to deal with some of the most common bugs, and notes which ones may be fixed in IE 7.

    In the previous article (which you can read here), I covered some cross browser compatibility issues that web developers and designers who use Cascading Style Sheets, or CSS, may run across.  We touched on the differences among the top browsers, and talked briefly about why they do what they do in regards to CSS.  In this article, I want to go a step further, and be specific about particular cross browser hacks and fixes, and to give you a few ways to overcome these particular issues.

    I do want to point out that while I can understand the necessity for these workarounds, I always advocate code that is 100% compliant.  When I write CSS, I try to make it as simple as possible, as I have found that the simpler the CSS, the less chance I have of design issues in Internet Explorer.  Sometimes, however, I just can’t achieve the look I want with the simple code.  Hence, I do at times use workarounds.

    In this article, you’re going to find that most of these workarounds deal with Internet Explorer, for the reason that we outlined in the first article.  Essentially, IE is a browser that “thinks” it knows what you are trying to tell it, instead of taking the directives in your CSS literally like Mozilla and Netscape based browsers.  If IE doesn’t quite understand something, like sloppy code or unsupported features, it attempts to do something anyway, instead of simply ignoring them, like Mozilla and Netscape based browsers.  Unfortunately, this results in major headaches for CSS developers.  Microsoft has attempted to help “dumb down” coding issues, resulting in more developers that write sloppy code, by having the browser anticipate the design.  There are obvious problems with this concept.  In my humble opinion, CSS code should be written, validated, and 100% compliant with the standards.

    However, there are some developers that like to write their CSS code to work (albeit incorrectly) in Internet Explorer, then provide hacks for Mozilla, Opera, Netscape and Firefox browsers.  The reason I don’t like this approach of writing code for IE then implementing workarounds for the other browsers that tend to be more compliant, is that many of these coders will have to go running back to their code to change it once IE decides it’s going to use the CSS the way it was designed: literally.  And trust me, they will eventually; IE 7 is said to have done this much better.  But just for argument’s sake, I will show a few examples of the most common workarounds.

    Note: using too many hacks will cause your code to break once IE 7 comes out. It seems that a few of the bugs that some of these hacks relate to have been fixed, as stated on MSDN’s IE Blog.  Even so, there will be a large number of non-compliant or quirky browsers out there that could still use them, as long as you are aware of the risk.  During the writing of this article, Microsoft released a beta version of IE 7.  In the next article, I will cover the CSS standards with which IE 7 is currently compliant. I have also gone back and made a note in each of the workarounds which have been said to be fixed in IE 7. 

    More Style Sheets Articles
    More By Jennifer Sullivan Cassidy


       · I have also seen this usage: @import url("url");It validates in XHTML...
     

    STYLE SHEETS ARTICLES

    - Image Replacement CSS Techniques
    - Using BlueTrip`s Success, Notice and Error C...
    - More Uses for the Thin and Caps CSS Classes ...
    - Styling Definition Lists with the BlueTrip C...
    - Styling Unordered and Ordered HTML Lists wit...
    - Using the BlueTrip CSS Framework`s Thin and ...
    - Adding Borders to Web Page Columns with Blue...
    - Introducing the BlueTrip CSS Framework
    - Using a Background Grid to Assist Web Page L...
    - Extending the Rule Of Thirds for Web Page La...
    - A Two-Column Web Page Layout Based on the Ru...
    - Using the Rule Of Thirds for Web Page Layout
    - Swapping Columns Using the Divine Ratio for ...
    - Using the Golden Ratio in Liquid Web Page De...
    - Fundamental Design Principles for Web Page L...







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek