<?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>Leeiio Chaos Made. &#187; !important</title>
	<atom:link href="http://leeiio.me/tag/important/feed/" rel="self" type="application/rss+xml" />
	<link>http://leeiio.me</link>
	<description>The world is golden.</description>
	<lastBuildDate>Thu, 26 Apr 2012 03:54:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>!important大法</title>
		<link>http://leeiio.me/important/</link>
		<comments>http://leeiio.me/important/#comments</comments>
		<pubDate>Fri, 21 Dec 2007 06:31:28 +0000</pubDate>
		<dc:creator>Leeiio</dc:creator>
				<category><![CDATA[Skill | 技术]]></category>
		<category><![CDATA[!important]]></category>

		<guid isPermaLink="false">http://www.guaniu.com/blog/2007/12/21/important.html</guid>
		<description><![CDATA[IE6的對css標準化的支持的不盡人意總叫人十分的惱火，比如我今天幫別人做blog的模板的時候，在FF下明明顯示好好的，可是跑到IE6下一看，嚴重錯位。怪自己平時對web標準化修煉不夠，解決不了。第一感覺是想到了IE hack的if語句，可是這樣的話就意味著要重新建立一個.css文件，這可不好，有沒有辦法在同一個.css文件里面定義樣式來區別FF和IE6呢？這時候搜索到了!important語句。我發現 #div{ background-color: red !important; background-color: blue; } 以上的定義在IE6中背景色變成了藍色而不是紅色，而在FF下是紅色。看來這個!important能解決我的問題。繼續搜索了下!important的作用，原來!important声明在IE6中并不是绝对的，它会被之后的同名属性定义所替换。也就是说在上面的例子中，IE6所应用的是最后一个背景色的值，即“blue”；而在FF中背景色的值为“red”。 还有一种方法，就是IE浏览器可以识别“>”等一些符号，如“~”、“`”、“background-color: blue; } 在FF中得到的是背景色红色，而在IE中得到的背景色是蓝色，根据样式重定义的规则，如果浏览器可以识别“>”，则应该得到的蓝色的背景，因此可以知道“>”只有IE可以识别。 这样，我们就可以把FF和IE的样式分离开。]]></description>
			<content:encoded><![CDATA[<p>IE6的對css標準化的支持的不盡人意總叫人十分的惱火，比如我今天幫別人做blog的模板的時候，在FF下明明顯示好好的，可是跑到IE6下一看，嚴重錯位。怪自己平時對web標準化修煉不夠，解決不了。第一感覺是想到了IE hack的if語句，可是這樣的話就意味著要重新建立一個.css文件，這可不好，有沒有辦法在同一個.css文件里面定義樣式來區別FF和IE6呢？這時候搜索到了!important語句。我發現<br />
<code>#div{<br />
background-color: red !important;<br />
background-color: blue;<br />
}</code><br />
<span id="more-69"></span><br />
以上的定義在IE6中背景色變成了藍色而不是紅色，而在FF下是紅色。看來這個!important能解決我的問題。繼續搜索了下!important的作用，原來!important声明在IE6中并不是绝对的，它会被之后的同名属性定义所替换。也就是说在上面的例子中，IE6所应用的是最后一个背景色的值，即“blue”；而在FF中背景色的值为“red”。<br />
还有一种方法，就是IE浏览器可以识别“>”等一些符号，如“~”、“`”、“<”等，都只有IE可以识别，但是不合理，!important是符合标准的。所以<br />
<code>#div{<br />
background-color: red;<br />
>background-color: blue;<br />
}</code><br />
在FF中得到的是背景色红色，而在IE中得到的背景色是蓝色，根据样式重定义的规则，如果浏览器可以识别“>”，则应该得到的蓝色的背景，因此可以知道“>”只有IE可以识别。</p>
<p>这样，我们就可以把FF和IE的样式分离开。</p>
]]></content:encoded>
			<wfw:commentRss>http://leeiio.me/important/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

