View Single Post
  #10 (permalink)  
Old 13-03-2008, 02:21 PM
PaulClark PaulClark is offline
Junior Member
 
Join Date: Mar 2008
Location: Kent, UK
Posts: 24
Default

Quote:
Originally Posted by Marcos117 View Post
I personally wouldn't advocate the use of conditional comments. It's actually not that hard to build a site without them that will render perfectly in IE6, IE7, firefox and safari...
Whether or not you'd advocate using conditional comments, it remains the correct way to target specific styles at IE6/7, recommended by Microsoft for exactly that purpose. (See MSDN Article on Conditional Comments.)

The two most common strategies are to 'hide' a call to an additional external stylesheet within the conditional comment or, as I prefer to do, to use conditional comments to wrap an additional named DIV around your whole HTML page if the browser is IE, and then target tweaks using dependent selectors.

Regarding creating sites that work cross-browser without specific browser targeting, this is possible for some basic sites, but as soon as you get more sophisticated it is impossible. Reasons for this include:
  • IE6 interprets the box model differently to other browsers. As such, if you are doing pixel perfect layout using padding, borders and margin you HAVE TO provide different dimensions to IE.
  • IE6 does not recognise min-width and min-height. It also interprets 'height' as other browsers interpret min-height. In complex designs, you will frequently need to set min-height on a DIV, then set height for IE6. You can not just set height for all browsers, as Firefox etc will interpret this as a fixed value and truncate your content if it overflows.
  • Certain effects can only be created in IE using microsoft-specific directives. Opacity is a good example. If you put microsoft-specific directives in your general CSS, it won't validate.
Reply With Quote