<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ilMilk.com &#187; 浏览器兼容</title>
	<atom:link href="http://www.ilmilk.com/tag/%e6%b5%8f%e8%a7%88%e5%99%a8%e5%85%bc%e5%ae%b9/feed" rel="self" type="application/rss+xml" />
	<link>http://www.ilmilk.com</link>
	<description>i LoVe Milk-ilMilk&#039;s Blog</description>
	<lastBuildDate>Thu, 21 Apr 2011 05:46:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>全面兼容IE6/IE7/IE8/FF的CSS HACK</title>
		<link>http://www.ilmilk.com/css-hack.html</link>
		<comments>http://www.ilmilk.com/css-hack.html#comments</comments>
		<pubDate>Sun, 18 Apr 2010 16:19:37 +0000</pubDate>
		<dc:creator>ilmilk</dc:creator>
				<category><![CDATA[CSS之美]]></category>
		<category><![CDATA[css hack]]></category>
		<category><![CDATA[浏览器兼容]]></category>

		<guid isPermaLink="false">http://ilmilk.com/?p=26</guid>
		<description><![CDATA[浏览器市场的混乱，给设计师造成很大的麻烦，设计的页面兼容完这个浏览器还得兼容那个浏览器，本来ie6跟ff之间的兼容是很容易解决的。加上个ie7会麻烦点，ie8的出现就更头疼了，原来hack ie7的方法又不能用了，怎么办呢？ 第一种方法： &#60;meta http-equiv=&#8221;x-ua-compatible&#8221; content=&#8221;ie=7&#8243; /&#62; 把这段代码放到&#60;head&#62;里面，在ie8里面的页面解析起来就跟ie7一模一样的了，所以，基本上可以无视ie8，剩下的代码只需要这样写就可以了。 background:#ffc; /*  对firefox有效*/ *background:#ccc; /* 对ie7有效 */ _background:#000; /* 只对ie6有效 */ 解释一下吧： firefox能解析第一段，后面的两个因为前面加了特殊符号“*”和“_”,firefox认不了，所以只认background:#ffc，看到的是黄色； ie7前两短都能认，以最后的为准，所以最后解析是background:#ccc，看到的是灰色； ie6三段都能认，而且“_”这个只有ie6能认，所以最后解析是_background:#000，看到的是黑色 阿门！已经是最简单和最好理解的写法了，如果你是google进来的，我可以很负责任的告诉你，这种方法是ok的，我测试过。 ie8的那段兼容7的代码我也测试过了，在我现在的windos 7 测试版所带的ie8是没问题的，以后ie8正式版出来还管不管用就不知道了。 ps：如果你发现按我这样写还是有问题的话，请查看一下你的html头，看看&#60;head&#62;之前的内容是不是这样的标准写法 &#60;!DOCTYPE html PUBLIC &#8220;-//W3C//DTD XHTML 1.0 Transitional//EN&#8221; &#8220;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#8220;&#62; &#60;html xmlns=&#8221;http://www.w3.org/1999/xhtml&#8220;&#62; 这个是现在比较规范的写法，如果你是用dreamweaver做页面的话，默认也是这种规范的，切记，非这种规范写法的，兼容性不能保证 第二种方法： 要求苛刻的朋友是不愿意在页面头部增加&#60;meta http-equiv=&#8221;x-ua-compatible&#8221; content=&#8221;ie=7&#8243; /&#62;这样一句代码的，因为这样的结果是每个页面都得加。那么要想兼容这几个浏览器还真得想别的办法了。早些天本站发布了一篇《完美兼容ie6,ie7,ie8以及firefox的css透明滤镜》，可能当时测试的疏忽，IE8的兼容性没有解决好，好多朋友回复说用不了。今天抽出些时间，查阅大量资料，终于解决了这个问题了。 以下是兼容IE6/IE7/IE8/FF的写法，注意下面的顺序不可颠倒 margin-bottom:40px;       /*ff的属性*/ margin-bottom:140px\9;    /* IE6/7/8的属性 */ color:red\0;              /* IE8支持 */ 


<ol><li><a href='http://www.ilmilk.com/ie6-absolute-positioning-bug-and-the-solution.html' rel='bookmark' title='Permanent Link: IE6绝对定位的bug和解决方法'>IE6绝对定位的bug和解决方法</a></li>
<li><a href='http://www.ilmilk.com/use-css-highlight-the-different-types-of-links.html' rel='bookmark' title='Permanent Link: 利用CSS突出显示不同类型的链接'>利用CSS突出显示不同类型的链接</a></li>
<li><a href='http://www.ilmilk.com/framework-for-the-beginning-of-the-experience-of-960-2.html' rel='bookmark' title='Permanent Link: 960框架之初体验'>960框架之初体验</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>浏览器市场的混乱，给设计师造成很大的麻烦，设计的页面兼容完这个浏览器还得兼容那个浏览器，本来ie6跟ff之间的兼容是很容易解决的。加上个ie7会麻烦点，ie8的出现就更头疼了，原来hack ie7的方法又不能用了，怎么办呢？</p>
<p>第一种方法：</p>
<blockquote><p>&lt;meta http-equiv=&#8221;x-ua-compatible&#8221; content=&#8221;ie=7&#8243; /&gt;</p></blockquote>
<p>把这段代码放到&lt;head&gt;里面，在ie8里面的页面解析起来就跟ie7一模一样的了，所以，基本上可以无视ie8，剩下的代码只需要这样写就可以了。<span id="more-26"></span></p>
<blockquote><p>background:#ffc; /*  对firefox有效*/<br />
*background:#ccc; /* 对ie7有效 */<br />
_background:#000; /* 只对ie6有效 */</p></blockquote>
<p>解释一下吧：</p>
<p>firefox能解析第一段，后面的两个因为前面加了特殊符号“*”和“_”,firefox认不了，所以只认background:#ffc，看到的是黄色；</p>
<p>ie7前两短都能认，以最后的为准，所以最后解析是background:#ccc，看到的是灰色；</p>
<p>ie6三段都能认，而且“_”这个只有ie6能认，所以最后解析是_background:#000，看到的是黑色</p>
<p>阿门！已经是最简单和最好理解的写法了，如果你是google进来的，我可以很负责任的告诉你，这种方法是ok的，我测试过。</p>
<p>ie8的那段兼容7的代码我也测试过了，在我现在的windos 7 测试版所带的ie8是没问题的，以后ie8正式版出来还管不管用就不知道了。</p>
<p>ps：如果你发现按我这样写还是有问题的话，请查看一下你的html头，看看&lt;head&gt;之前的内容是不是这样的标准写法</p>
<blockquote><p>&lt;!DOCTYPE html PUBLIC &#8220;-//W3C//DTD XHTML 1.0 Transitional//EN&#8221; &#8220;<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</a>&#8220;&gt;<br />
&lt;html xmlns=&#8221;<a href="http://www.w3.org/1999/xhtml">http://www.w3.org/1999/xhtml</a>&#8220;&gt;</p></blockquote>
<p>这个是现在比较规范的写法，如果你是用dreamweaver做页面的话，默认也是这种规范的，切记，非这种规范写法的，兼容性不能保证</p>
<p>第二种方法：</p>
<p>要求苛刻的朋友是不愿意在页面头部增加&lt;meta http-equiv=&#8221;x-ua-compatible&#8221; content=&#8221;ie=7&#8243; /&gt;这样一句代码的，因为这样的结果是每个页面都得加。那么要想兼容这几个浏览器还真得想别的办法了。早些天本站发布了一篇《完美兼容ie6,ie7,ie8以及firefox的css透明滤镜》，可能当时测试的疏忽，IE8的兼容性没有解决好，好多朋友回复说用不了。今天抽出些时间，查阅大量资料，终于解决了这个问题了。</p>
<p>以下是兼容IE6/IE7/IE8/FF的写法，注意下面的顺序不可颠倒</p>
<blockquote><p>margin-bottom:40px;       /*ff的属性*/<br />
margin-bottom:140px\9;    /* IE6/7/8的属性 */<br />
color:red\0;              /* IE8支持 */<br />
*margin-bottom:450px;     /*IE6/7的属性*/</p></blockquote>


<p><ol><li><a href='http://www.ilmilk.com/ie6-absolute-positioning-bug-and-the-solution.html' rel='bookmark' title='Permanent Link: IE6绝对定位的bug和解决方法'>IE6绝对定位的bug和解决方法</a></li>
<li><a href='http://www.ilmilk.com/use-css-highlight-the-different-types-of-links.html' rel='bookmark' title='Permanent Link: 利用CSS突出显示不同类型的链接'>利用CSS突出显示不同类型的链接</a></li>
<li><a href='http://www.ilmilk.com/framework-for-the-beginning-of-the-experience-of-960-2.html' rel='bookmark' title='Permanent Link: 960框架之初体验'>960框架之初体验</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.ilmilk.com/css-hack.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

