<?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>浮山狼de博客 &#187; IE</title>
	<atom:link href="https://www.fushanlang.com/tag/ie/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.fushanlang.com</link>
	<description>next station - 下一站，活在当下，且行且思</description>
	<lastBuildDate>Sat, 29 Nov 2014 15:14:11 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.2.5</generator>
	<item>
		<title>IE下css样式控制</title>
		<link>https://www.fushanlang.com/css-style-control-under-ie-1532/</link>
		<comments>https://www.fushanlang.com/css-style-control-under-ie-1532/#comments</comments>
		<pubDate>Mon, 27 Dec 2010 06:36:56 +0000</pubDate>
		<dc:creator><![CDATA[fushanlang]]></dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[IE]]></category>

		<guid isPermaLink="false">http://www.fushanlang.com/blog/?p=1532</guid>
		<description><![CDATA[<p>做网站的前台程序员应该都吃过不同浏览器下css样式差别的苦头，尤其是IE6，总是带给我们无尽的回忆。:)</p> <p>今天在这片日志里想稍微总结一下IE下样式控制应该注意的几点。</p> 1. CSS HACK IE6，IE7,IE8 对css样式属性的接受程度为: ———————IE6——    IE7——IE8--NoneIE &#62;property——    Y——    Y——    Y——    N—— .property——    Y——    Y——    Y——    N—— *property——    Y——    Y——    Y——    N—— _property——    Y——    N——    N——  N—— 同时IE6不支持!important. 其实主要是浏览器：IE6/IE7/firefox下，各个对CSS代码的解释有区别，下边转载一篇HACK的文章，相当实用。 区别IE6与FF：           background:orange;*background:blue; 区别IE6与IE7：          background:green !important;background:blue; 区别IE7与FF：           background:orange; *background:green; 区别FF/IE7/IE6：       background:orange;*background:green !important;*background:blue; 注：IE都能识别*标准浏览器(如FF)不能识别* IE6能识别*，但不能识别 !important IE7能识别*，也能识别!important FF不能识别*，但能识别!important 另外再补充一个，下划线"_", IE6支持下划线，IE7和firefox均不支持下划线。所以针对IE6采用下划线属性也是一个常用方法。 于是大家还可以这样来区分IE6、IE7、firefox : background:orange;*background:green;_background:blue; <p></p> * html  p {color:#f00;}            支持 IE6        不支持FF IE7 IE8b *+html p {color:#f00;}        <span style="color:#777"> . . . &#8594; Read More: <a href="https://www.fushanlang.com/css-style-control-under-ie-1532/">IE下css样式控制</a></span>]]></description>
				<content:encoded><![CDATA[<p>做网站的前台程序员应该都吃过不同浏览器下css样式差别的苦头，尤其是IE6，总是带给我们无尽的回忆。:)</p>
<p>今天在这片日志里想稍微总结一下IE下样式控制应该注意的几点。</p>
<h3><strong>1. CSS HACK</strong></h3>
<pre>IE6，IE7,IE8 对css样式<strong>属性</strong>的接受程度为:

———————IE6——    IE7——IE8--NoneIE
&gt;property——    Y——    Y——    Y——    N——
.property——    Y——    Y——    Y——    N——
*property——    Y——    Y——    Y——    N——
_property——    Y——    N——    N——  N——

同时IE6不支持!important.

其实主要是浏览器：IE6/IE7/firefox下，各个对CSS代码的解释有区别，下边转载一篇HACK的文章，相当实用。

区别IE6与FF：           background:orange;*background:blue;

区别IE6与IE7：          background:green <strong>!important</strong>;background:blue;

区别IE7与FF：           background:orange; <strong>*</strong>background:green;

区别FF/IE7/IE6：       background:orange;<strong>*</strong>background:green <strong>!important</strong>;<strong>*</strong>background:blue;

注：IE都能识别*标准浏览器(如FF)不能识别*
IE6能识别*，但不能识别 !important
IE7能识别*，也能识别!important
FF不能识别*，但能识别!important

另外再补充一个，下划线"_",
IE6支持下划线，IE7和firefox均不支持下划线。所以针对IE6采用下划线属性也是一个常用方法。<span id="more-1532"></span>

于是大家还可以这样来区分IE6、IE7、firefox
: background:orange;*background:green;_background:blue;</pre>
<p><img src="http://www.fushanlang.com/blog/wp-content/uploads/auto_save_image/2010/12/195051OQr.jpg" border="0" alt="" /></p>
<pre>* html  p {color:#f00;}            支持 IE6        不支持FF IE7 IE8b

*+html p {color:#f00;}            支持 IE7 IE8b        不支持FF IE6

p {*color:#f00;}            支持 IE7 IE6        不支持FF IE8

注：不管是什么方法，书写的顺序都是firefox的写在前面，IE7的写在中间，IE6的写在后面。</pre>
<h3>2.兼容性技巧</h3>
<p><span style="font-family: 宋体;"><strong>清除浮动：</strong>将以下代码加入Global CSS 中,给需要闭合的div加上 即可,屡试不爽.<br />
&lt;style&gt;<br />
/* Clear Fix */</span></p>
<p><span style="font-family: 宋体;">.clearfix:after<br />
{<br />
content:&#8221;.&#8221;;<br />
display:block;<br />
height:0;<br />
clear:both;<br />
visibility:hidden;<br />
}<br />
.clearfix<br />
{<br />
display:inline-block;<br />
}<br />
/* Hide from IE Mac */<br />
.clearfix {display:block;}<br />
/* End hide from IE Mac */<br />
/* end of clearfix */<br />
&lt;/style&gt;</span></p>
<p>1, FF下给 div 设置<strong> padding 后会导致 width 和 height </strong>增加, 但IE不会.(可用!important解决)<br />
2.<strong>垂直居中</strong>.将 line-height 设置为 当前 div 相同的高度, 再通过 vertical-align: middle.( 注意内容不要换行.)<br />
3.<strong>水平居中</strong>. margin: 0 auto;(当然不是万能)<br />
4.若需给<strong> a 标签内内容加上 样式, 需要设置 display: block;</strong>(常见于导航标签)<br />
5. FF 和 IE 对 BOX 理解的差异导致相差 2px 的还有设为 <strong>float的div在ie下 m问</strong><strong><span style="font-family: 宋体;">argin加倍等</span></strong><span style="font-family: 宋体;"><strong>题</strong>.<br />
6. ul 标签在 FF 下面默认有 list-style 和 padding . 最好事先声明, 以避免不必要的麻烦. (常见于导航标签和内容列表)<br />
7. <strong>作为外部 wrapper 的 div 不要定死高度, 最好还加上 overflow: hidden.</strong>以达到高度自适应.</span></p>
<h3><span style="font-family: 宋体;">3.<strong>IE6特别处理</strong></span></h3>
<p><span style="font-family: 宋体;">IE6并不支持CSS2，很多hover伪类只能用在标签A上，所以，为了让某些常用类或标签也能用上hover样式改变的效果，需要配合javascript，对绑定的元素进行手动控制。常见的有直接通过jQuery类库的css选择器</span></p>
<p><span style="font-family: 宋体;">$(&#8216;css selector&#8217;).hover(function(){$(this).toggleClass(&#8216;hover类名&#8217;);},</span><span style="font-family: 宋体;">function(){$(this).toggleClass(&#8216;hover类名&#8217;);}</span><span style="font-family: 宋体;">);</span></p>
<p><span style="font-family: 宋体;">IE6默认的标签有些有默认的margin，padding，所以为了保持多个浏览器下一致性，建议在css样式开头将大部分标签的margin：0px，padding：0px，进行清零处理。</span></p>
<p><span style="font-family: 宋体;"><strong>例如Form标签，在IE6下默认是有margin的。另外IE6不支持png样式透明的问题，大都可以通过javascript来处理，常用的有“</strong></span>DD_belatedPNG_0.0.8a.js<span style="font-family: 宋体;"><strong>”，操作比较简单，只需要为制定的css 选择器fix一下就可以了。</strong></span></p>
<h3><span style="font-family: 宋体;"><strong>4.IE only语法</strong></span></h3>
<p><span style="font-family: 宋体;"><strong><br />
</strong></span></p>
]]></content:encoded>
			<wfw:commentRss>https://www.fushanlang.com/css-style-control-under-ie-1532/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
