Please let me apologize for my last message, my webmail time out.

Nancy Johnson wrote:

> I have a question related to the same issue.
> 
> I am converting a very poorly constructed table based site to CSS.
> 
> It is a tight fixed width site. Since it is a child of a larger site,
> I don't feel I can convert to a more fluid site or change the look and> feel.
> 
> I have used
> /*** IE Fix ***/
> * html
> 
> to acommodate both IE6 and IE7 issues which seem to work.
> 
> My more recent readings indicate that this method isn't isn't
> recommended as a css fix and doesn't fix IE7, although it seemed to in
> most instances
> 
> I also had one instance where IE6 needed fixing and not IE7. *html fixed both.
> 
> Is @import?
> 
> or
> 
> <!--[if IE.xx]>
> <link rel="stylesheet" type="text/css" media="screen"
> href="/css/IEstylesheet.css" /
> <![endif]-->
> 
> a better way?
> 
> Thanks in advance,
> 
> Nancy

Hi Nancy. This is a hotly disputed topic with a myriad of threads in the list 
archives and a special page in this list's wiki "To hack or not to hack" [1] or 
there is also much debate whether to use CSS hacks or IE Conditional Comments 
in the html. If you are working for a client and delivering a product which you 
will not be around to maintain, then the safest method is to use IE Conditional 
Comments. This could be done also by.

<!--[if IE]>
<style type="text/css">
@import "ie-style.css";
</style>
<![endif]-->

and separating the particular versions of IE in the one stylesheet. This above 
import filter will be hidden from IE 4. A full list of import hacks [2] show 
various methods. If the pages are always maintained by yourself. This method 
may work better for you.

* html #content {...}

This will target IE 5~6 and IE 7 in quirks mode [3] and for IE 7 in standards 
mode [3] this works.

*+html /* target IE 7 without the xml prolog */

*:first-child+html /* target IE 7 with the xml prolog */

Note that with the xml prolog, Opera will also be targeted by similar hacks 
meant only for IE [3].

Hacks like.

*html #content {...}

or 

#content {*background:red;}

cause parsing errors so whatever style declarations are included may not be 
able to be validated.

All the import hacks that only target IE are invalid so use with caution. When 
using any hacks it is wise to know the full consequence of the method used. 
Some of the hacks that target IE/win 5~6 may also target IE/mac. There is one 
well know method to hide these rules from IE/mac or only show rules for IE/mac. 
When using any hacks it is good practice to comment what browsers are targeted 
and why the have been used. A good is resource of many methods with the pro and 
cons are found here [4].

There is also the common inappropriate use of hacks. Some authors will go 
straight for a hack if a part of a page layout has a few pixels in difference. 
Browsers default settings are always slightly difference. There could also be a 
scenario like.

<div id="sidebar">.....</div>
<div id="content">.....</div>

#sidebar {float:left;}

#content {width:600px;margin-left:200px;}

Instead of hacking, one solution is to avoid the effects of hasLayout [4] in IE 
by removing the haslayout trigger of width.

#content {margin-left:200px;}

I personally use * html and *:first-child+html since I prefer to keep the hacks 
together with the rules they relate to. I use the xml prolog to send IE 6 into 
quirks mode so I do not have to hack for IE/win 5 separately. I generally find 
that I do "not" have to hack for IE7, but this also means that I am also coding 
to keep IE 7 happy. This is something I'm slowly moving away from though.

I finding early 2008 to be very hacky time, but with the coming release of IE8 
early this year. This could become very important issue. Good luck with your 
project.

1. <http://css-discuss.incutio.com/?page=ToHackOrNotToHack>
2. <http://imfo.ru/csstest/css_hacks/import.php>
3. <http://css-class.com/test/css/selectors/ie7hacktargetingopera.htm>
4. <http://www.webdevout.net/css-hacks>Alanhttp://css-class.com/

Alan

http://css-class.com/

______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to