<?xml version="1.0" encoding="UTF-8"?>
  <feed xmlns="http://www.w3.org/2005/Atom">
  <title type="html"><![CDATA[CSS Web Design 我爱CSS]]></title>
  <subtitle type="html"><![CDATA[Web标准化 Div+css教程]]></subtitle>
  <id>http://www.52css.com/</id> 
  <link rel="alternate" type="text/html" href="http://www.52css.com/" /> 
  <link rel="self" type="application/atom+xml" href="http://www.52css.com/atom.asp" /> 
  <generator uri="http://www.pjhome.net/" version="2.4.1022">PJBlog2</generator> 
  <updated>2010-03-28T16:39:50+08:00</updated> 

  <entry>
	  <title type="html"><![CDATA[欢迎购买：变幻之美 DivCSS网页布局揭秘（全彩印）]]></title>
	  <author>
		 <name>52css</name>
		 <uri>http://www.52css.com/</uri>
		 <email>MrJin@52css.com</email>
	  </author>
	  <category term="" scheme="http://www.52css.com/default.asp?cateID=3" label="Div+CSS教程" /> 
	  <updated>2010-03-28T16:39:50+08:00</updated>
	  <published>2010-03-28T16:39:50+08:00</published>
		  <summary type="html"><![CDATA[　　<br/>　　<br/>　　52CSS站长，编著的新书<br/>　　《变幻之美&nbsp;DivCSS网页布局揭秘&nbsp;-&nbsp;案例实战篇》（全彩印）<br/>　　已经出版发行啦。欢迎大家购买阅读。共同学习！<br/><br/>　　◎&nbsp;<a target="_blank" href="http://product.dangdang.com/product.aspx?product_id=20675720">当当网&nbsp;dangdang.com&nbsp;￥33.80&nbsp;&nbsp;</a><br/>　　◎&nbsp;<a target="_blank" href="http://www.amazon.cn/mn/detailApp/ref=sr_1_1?_encoding=UTF8&amp;s=books&amp;qid=1252638613&amp;asin=B002OHCHQM&amp;sr=8-1">卓越网&nbsp;amazon.cn&nbsp;￥33.80&nbsp;</a>&nbsp;<br/>　　◎&nbsp;<a target="_blank" href="http://www.china-pub.com/47922&amp;ref=ps">互动网&nbsp;china-pub.com&nbsp;￥33.75&nbsp;</a><br/>　　◎&nbsp;<a target="_blank" href="http://www.ptpress.com.cn/Book.aspx?id=17286">人民邮电出版社&nbsp;￥36.1&nbsp;</a><br/><br/>　　详细请看，本书专题页：<a target="_blank" href="http://www.52css.com/book/">http://www.52css.com/book/</a>&nbsp;或&nbsp;<a target="_blank" href="http://52css.com/book/">http://52css.com/book/</a><br/><br/><div align="center"><img src="http://www.52css.com/attachments/month_0909/y2009911163936.jpg" border="0" alt=""/></div><br/>]]></summary>
	  <link rel="alternate" type="text/html" href="http://www.52css.com/default.asp?id=1109" /> 
	  <id>http://www.52css.com/default.asp?id=1109</id> 
  </entry>	
		
  <entry>
	  <title type="html"><![CDATA[CSS技术理论：CSS层叠与继承]]></title>
	  <author>
		 <name>52css</name>
		 <uri>http://www.52css.com/</uri>
		 <email>MrJin@52css.com</email>
	  </author>
	  <category term="" scheme="http://www.52css.com/default.asp?cateID=5" label="CSS2.0教程" /> 
	  <updated>2010-03-11T20:05:43+08:00</updated>
	  <published>2010-03-11T20:05:43+08:00</published>
		  <summary type="html"><![CDATA[<strong>一、CSS层叠</strong><br/><br/>　　我们知道文档中的一个元素可能同时被多个css选择器选中，每个选择器都有一些css规则，这就是层叠。这些规则有可能不矛盾的，自然这些规则将会同时起效，然而有些规则是相互冲突的，例如：<br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.52css.com/images/quote.gif" style="margin:0px 2px -3px 0px" alt="div css xhtml xml Example Source Code"/> Example Source Code <span style="font-weight:100;color:#f7f7f7;">[www.52css.com]</span></div><div class="UBBContent">&lt;html&nbsp;xmlns=&#34;<a href="http://www.w3.org/1999/xhtml" target="_blank">http://www.w3.org/1999/xhtml</a>&#34;&gt;<br/>&lt;head&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;CSS&nbsp;Cascade&lt;/title&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&lt;style&nbsp;type=&#34;text/css&#34;&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;h1{color:Red;}<br/>&nbsp;&nbsp;&nbsp;&nbsp;body&nbsp;h1{color:Blue;}<br/>&nbsp;&nbsp;&nbsp;&nbsp;&lt;/style&gt;<br/>&lt;/head&gt;<br/>&lt;body&gt;<br/>&lt;h1&gt;Hello&nbsp;52CSS.com&lt;/h1&gt;<br/>&lt;/body&gt;<br/>&lt;/html&gt;</div></div><br/>　　为此需要为每条规则制定特殊性，当发生冲突的时候必须选出一条最高特殊性的规则来应用。CSS规则的特殊性可以用4个整数来表示，例如0，0，0，0.计算规则如下：<br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.52css.com/images/quote.gif" style="margin:0px 2px -3px 0px" alt="div css xhtml xml Example Source Code"/> Example Source Code <span style="font-weight:100;color:#f7f7f7;">[www.52css.com]</span></div><div class="UBBContent">对于规则中的每个ID选择符，特殊性加0，1，0，0&nbsp;<br/>对于规则中每个类选择符和属性选择符以及伪类，特殊性加0，0，1，0&nbsp;<br/>对于规则中的每个元素名或者伪元素，特殊性加0，0，0，1&nbsp;<br/>对于通配符，特殊性加0，0，0，0.&nbsp;<br/>对于内联规则，特殊性加&nbsp;1，0，0，0&nbsp;</div></div><br/>　　最终得到结果就是这个规则的特殊性。两个特殊性的比较类似字符串大小的比较，是从左往右依次比较，第一个数字大的规则的特殊性高。上例中两条规则的特殊性分别是0，0，0，1&nbsp;和&nbsp;0,0,0,2，显然第二条胜出，因此最终字是蓝色的。<br/>　　注意，通配符的特殊性0,0,0,0看起来没有作用，实际上不是，还有一种没有特殊性的规则，0，0，0，0要比没有特殊性更特殊，下面会介绍。<br/>　　css还有一个!important标签，用来改变css规则的特殊性。实际上，在解析css规则特殊性的时候，是将具有!important的规则和没有此标签的规则利用上述方法分别计算特殊性，分别选出特殊性最高的规则。最终合并的时候，具有任何特殊性的带有!important标记的规则胜出。<br/><br/><strong>二、CSS继承</strong><br/><br/>　　所谓继承，就是父元素的规则也会适用于子元素。比如给body设置为color:Red;那么他内部的元素如果没有其他的规则设置，也都会变成红色。继承得来的规则没有特殊性。下面看一个简单的例子：<br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.52css.com/images/quote.gif" style="margin:0px 2px -3px 0px" alt="div css xhtml xml Example Source Code"/> Example Source Code <span style="font-weight:100;color:#f7f7f7;">[www.52css.com]</span></div><div class="UBBContent">&lt;html&nbsp;xmlns=&#34;<a href="http://www.w3.org/1999/xhtml" target="_blank">http://www.w3.org/1999/xhtml</a>&#34;&gt;<br/>&lt;head&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;CSS&nbsp;Cascade&lt;/title&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&lt;style&nbsp;type=&#34;text/css&#34;&gt;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*{color:Blue;}<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;div{color:Black;}<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.imp{color:Red&nbsp;!important;}<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#content{color:Green;}&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&lt;/style&gt;<br/>&lt;/head&gt;<br/>&lt;body&gt;<br/>&nbsp;&lt;div&gt;Hello&nbsp;&lt;span&gt;52CSS.com&lt;/span&gt;&nbsp;&lt;/div&gt;<br/>&nbsp;&lt;div&nbsp;id=&#34;content&#34;&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&lt;p&nbsp;class=&#34;imp&#34;&gt;Title&lt;/p&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;Content&nbsp;Goes&nbsp;Here.<br/>&nbsp;&lt;/div&gt;<br/>&lt;/body&gt;<br/>&lt;/html&gt;</div></div>&nbsp;<br/>　　注意，第一行的Css并没有继承div的黑色，这是因为通配符的缘故。通配符的特殊性虽然是全0，但是还是比继承的特殊性要高。第二行展示了!important标记的作用。<br/>　　另外，一些明显不应该继承的属性，比如border,margin,padding之类的是不会被继承的，具体可以参考css手册。<br/><br/><strong>三、其他</strong><br/><br/>　　虽然有4个整数来表示一个特殊性，仍然有可能出现两条冲突的规则的特殊性完全一致的情况，此时就按照css规则出现的顺序来确定，在样式表中最后一个出现的规则胜出。一般不会出现这样的情况，只有一个情况例外，考虑如下样式表：<br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.52css.com/images/quote.gif" style="margin:0px 2px -3px 0px" alt="div css xhtml xml Example Source Code"/> Example Source Code <span style="font-weight:100;color:#f7f7f7;">[www.52css.com]</span></div><div class="UBBContent">:active{color:Red;}<br/>:hover{color:Blue;}<br/>:visited{color:Purple;}<br/>:link{color:Green;}&nbsp;</div></div>&nbsp;&nbsp;&nbsp;<br/>　　这样页面中的链接永远也不会显示红色和蓝色，因为一个链接要么被访问过，要么没有被访问过。而这两条规则在最后，因此总会胜出。如果改成这样:<br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.52css.com/images/quote.gif" style="margin:0px 2px -3px 0px" alt="div css xhtml xml Example Source Code"/> Example Source Code <span style="font-weight:100;color:#f7f7f7;">[www.52css.com]</span></div><div class="UBBContent">:link{color:Green;}&nbsp;&nbsp;<br/>:visited{color:Purple;}<br/>:hover{color:Blue;}<br/>:active{color:Red;}</div></div><br/>　　就能实现鼠标悬停和点击的瞬间变色的效果。这样的顺序的首字母正好连成&nbsp;“LoVe&nbsp;HA”,这样的顺序被约定俗成的叫做Love&nbsp;Ha&nbsp;规则。特殊性规则从理论上讲比较抽象和难懂，但在实践中，只要样式表是设计良好的，并不会有太多这方面的困扰，因此本文也不再做深究，更多的技术请参考52CSS.com的文章更新！<br/>　　　　]]></summary>
	  <link rel="alternate" type="text/html" href="http://www.52css.com/default.asp?id=1160" /> 
	  <id>http://www.52css.com/default.asp?id=1160</id> 
  </entry>	
		
  <entry>
	  <title type="html"><![CDATA[CSS学习笔记：id与class、padding和margin、min-height和height]]></title>
	  <author>
		 <name>52css</name>
		 <uri>http://www.52css.com/</uri>
		 <email>MrJin@52css.com</email>
	  </author>
	  <category term="" scheme="http://www.52css.com/default.asp?cateID=3" label="Div+CSS教程" /> 
	  <updated>2010-03-03T22:58:30+08:00</updated>
	  <published>2010-03-03T22:58:30+08:00</published>
		  <summary type="html"><![CDATA[　　<strong>id和class到底要用哪一个？</strong><br/><br/>　　首先要明白id和class的各自的优缺点。这样才能根据他们的各自的特点进行使用。<br/>　　id的优点（class的缺点）：id写在css用&#34;#&#34;选择器，class写在css中用&#34;.&#34;选择器。&#34;#&#34;选择器的优先级高于&#34;.&#34;选择器大约10倍，所以当你需要提升优先级的时候，id标签，或者id容器内的标签将是很容易和有效的。而class标签，或者class容器内的标签将可能导致优先级的提升失败。<br/>　　id的缺点（class的优点）：id应该是唯一的，所以它的可复用性是很差的，而class是可以复用的。所以如果一块东西是多个页面，甚至一个页面都会使用多次的，那么一定要使用class来作为样式选择器。id是唯一的，当一个控件的id的产生是不可控的，那么这个id选择器将失去意义，但是任何一个控件即使是动态产生的，他的cssClass仍然是可定制的，所以当你的这个标签需要用服务器端控件替代的时候，而服务器端控件的id是不确定的，那么请使用class选择器，这样只要将服务器端控件的cssClass设为你class选择器的名称即可。（当然，这个还需要大量的经验的积累，项目做的多了就会逐步的改进）&nbsp;<br/><br/>　　<strong>padding和margin到底要用哪一个？</strong>&nbsp;<br/><br/>　　padding和margin可以让一块区域的外观显示完全一样。所以可能让很多人认为padding和margin是可以互换的。其实它们的差别很大，而且选择哪个需要认真和慎重地考虑。我认为对容器使用padding还是对容器内的标签使用margin的原则：当隐藏这个容器或者容器内的标签时（现实项目中其实经常需要将某个部件隐藏、显示），对整体布局影响最小为益。<br/>　　对于padding再说一句：ie6，ie7（FF）对带有padding样式的标签的宽度的解析是不一样的。ie6的标签宽度不包含padding-left和padding-right的值，而ie7和ff则是包含的。例如一个div的width设置100px，padding设为10px，而在ie6中它要占据的宽度是120px（包含10个padding-left和10个padding-right），而在ie7和ff中则占据100px的宽度。因为ie7和ff会认为100已经包含了20px的padding。&nbsp;<br/><br/>　　<strong>min-height和height</strong><br/><br/>　　如果你只需要兼容ie6那么你完全不需要注意min-height这个样式，因为ie6根本就不支持这个样式。但是当你的页面需要照顾到ie7和ff的时候，这个样式一定要注意。因为很多在ie6下设置了height=固定值的样式，当容器被里面的东西撑的大于这个高度的时候，ie7和ff是不会自适应高度的。从而导致布局的混乱。要想在ie6，ie7和ff中都可以自适应高度，正确的做法是设置min-height和用cssHack设置height。例如：<br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.52css.com/images/quote.gif" style="margin:0px 2px -3px 0px" alt="div css xhtml xml Example Source Code"/> Example Source Code <span style="font-weight:100;color:#f7f7f7;">[www.52css.com]</span></div><div class="UBBContent">　　min-height:600px;<br/>　　_height:600px;</div></div><br/>　　这样，在容器里面的东西很少的时候，它显示固定高度600px，但当里面的东西很多的时候，它也会自适应的增长高度。<br/>　　对于height的设置一定要特别注意，如果是布局用的容器的height则需要特别的注意，否则在ff中会导致无法浮起，从而使布局混乱。&nbsp;<br/>　　]]></summary>
	  <link rel="alternate" type="text/html" href="http://www.52css.com/default.asp?id=1159" /> 
	  <id>http://www.52css.com/default.asp?id=1159</id> 
  </entry>	
		
  <entry>
	  <title type="html"><![CDATA[CSS经验分享：如何书写可维护的CSS代码？]]></title>
	  <author>
		 <name>52css</name>
		 <uri>http://www.52css.com/</uri>
		 <email>MrJin@52css.com</email>
	  </author>
	  <category term="" scheme="http://www.52css.com/default.asp?cateID=5" label="CSS2.0教程" /> 
	  <updated>2010-02-07T23:09:54+08:00</updated>
	  <published>2010-02-07T23:09:54+08:00</published>
		  <summary type="html"><![CDATA[　　在前几天的文章中，我们讨论过书写高效CSS注意的七个方面。今天我们在52CSS.com和大家讨论如何书写可维护的CSS代码？<br/><br/>　　一、在样式表开头添加一个注释块，用以描述这个样式表的创建日期、创建者、标记等备注信息。<br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.52css.com/images/quote.gif" style="margin:0px 2px -3px 0px" alt="div css xhtml xml Example Source Code"/> Example Source Code <span style="font-weight:100;color:#f7f7f7;">[www.52css.com]</span></div><div class="UBBContent">/*&nbsp;<br/>---------------------------------<br/>Site:&nbsp;Site&nbsp;name&nbsp;<br/>Author:&nbsp;52CSS.com<br/>Up&#100;ated:&nbsp;Date&nbsp;and&nbsp;time&nbsp;<br/>Up&#100;ated&nbsp;by:&nbsp;Name&nbsp;<br/>---------------------------------&nbsp;<br/>*/&nbsp;</div></div><br/>　　二、包括公用颜色标记&nbsp;<br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.52css.com/images/quote.gif" style="margin:0px 2px -3px 0px" alt="div css xhtml xml Example Source Code"/> Example Source Code <span style="font-weight:100;color:#f7f7f7;">[www.52css.com]</span></div><div class="UBBContent">/*&nbsp;<br/>---------------------------------&nbsp;<br/>COLORS<br/>Body&nbsp;background:&nbsp;#def455<br/>Container&nbsp;background:&nbsp;#fff&nbsp;<br/>Main&nbsp;Text:&nbsp;#333&nbsp;<br/>Links:&nbsp;#00600f&nbsp;<br/>Visited&nbsp;links:&nbsp;#098761&nbsp;<br/>Hover&nbsp;links:&nbsp;#aaf433&nbsp;<br/>H1,&nbsp;H2,&nbsp;H3:&nbsp;#960&nbsp;<br/>H4,&nbsp;H5,&nbsp;H6:&nbsp;#000&nbsp;<br/>---------------------------------<br/>*/</div></div>&nbsp;<br/>　　三、给ID和Class进行有意义的命名&nbsp;<br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.52css.com/images/quote.gif" style="margin:0px 2px -3px 0px" alt="div css xhtml xml Example Source Code"/> Example Source Code <span style="font-weight:100;color:#f7f7f7;">[www.52css.com]</span></div><div class="UBBContent">不推荐的命名方式：<br/>.green-box&nbsp;{&nbsp;...&nbsp;}&nbsp;<br/>#big-text&nbsp;{&nbsp;...&nbsp;}&nbsp;<br/><br/>推荐使用的命名方式：<br/>.pullquote&nbsp;{...&nbsp;}<br/>#introduction&nbsp;{...&nbsp;}&nbsp;</div></div><br/>　　四、将关联的样式规则进行整合&nbsp;<br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.52css.com/images/quote.gif" style="margin:0px 2px -3px 0px" alt="div css xhtml xml Example Source Code"/> Example Source Code <span style="font-weight:100;color:#f7f7f7;">[www.52css.com]</span></div><div class="UBBContent">#header&nbsp;{&nbsp;...&nbsp;}&nbsp;<br/>#header&nbsp;h1&nbsp;{&nbsp;...&nbsp;}&nbsp;<br/>#header&nbsp;h1&nbsp;img&nbsp;{&nbsp;...&nbsp;}<br/>#header&nbsp;form&nbsp;{&nbsp;...&nbsp;}<br/>#header&nbsp;a#skip&nbsp;{&nbsp;...&nbsp;}<br/><br/>#navigation&nbsp;{&nbsp;...&nbsp;}<br/>#navigation&nbsp;ul&nbsp;{&nbsp;...&nbsp;}<br/>#navigation&nbsp;ul&nbsp;li&nbsp;{&nbsp;...&nbsp;}<br/>#navigation&nbsp;ul&nbsp;li&nbsp;a&nbsp;{&nbsp;...&nbsp;}<br/>#navigation&nbsp;ul&nbsp;li&nbsp;a:hover&nbsp;{&nbsp;...&nbsp;}<br/><br/>#content&nbsp;{&nbsp;...&nbsp;}<br/>#content&nbsp;h2&nbsp;{&nbsp;...&nbsp;}<br/>#content&nbsp;p&nbsp;{&nbsp;...&nbsp;}<br/>#content&nbsp;ul&nbsp;{&nbsp;...&nbsp;}<br/>#content&nbsp;ul&nbsp;li&nbsp;{&nbsp;...&nbsp;}&nbsp;</div></div><br/>　　五、给样式添加清晰的注释&nbsp;<br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.52css.com/images/quote.gif" style="margin:0px 2px -3px 0px" alt="div css xhtml xml Example Source Code"/> Example Source Code <span style="font-weight:100;color:#f7f7f7;">[www.52css.com]</span></div><div class="UBBContent">/*<br/>---------------------------------&nbsp;<br/>header&nbsp;styles&nbsp;<br/>---------------------------------&nbsp;<br/>*/&nbsp;<br/>#header&nbsp;{&nbsp;...&nbsp;}<br/>#header&nbsp;h1&nbsp;{&nbsp;...&nbsp;}<br/>#header&nbsp;h1&nbsp;img&nbsp;{&nbsp;...&nbsp;}<br/>#header&nbsp;form&nbsp;{&nbsp;...&nbsp;}&nbsp;<br/><br/>/*&nbsp;<br/>---------------------------------&nbsp;<br/>navigation&nbsp;styles<br/>---------------------------------&nbsp;<br/>*/<br/>#navigation&nbsp;{&nbsp;...&nbsp;}&nbsp;</div></div><br/>　　在52CSS.com后面的文章中，我们将讨论如何管理你整站的CSS文件呢。请大家关注。<br/>　　]]></summary>
	  <link rel="alternate" type="text/html" href="http://www.52css.com/default.asp?id=1158" /> 
	  <id>http://www.52css.com/default.asp?id=1158</id> 
  </entry>	
		
  <entry>
	  <title type="html"><![CDATA[CSS文字控制之letter-spacing和word-spacing]]></title>
	  <author>
		 <name>52css</name>
		 <uri>http://www.52css.com/</uri>
		 <email>MrJin@52css.com</email>
	  </author>
	  <category term="" scheme="http://www.52css.com/default.asp?cateID=5" label="CSS2.0教程" /> 
	  <updated>2010-02-04T00:15:25+08:00</updated>
	  <published>2010-02-04T00:15:25+08:00</published>
		  <summary type="html"><![CDATA[　　letter-spacing和word-spacing这两个属性都用来添加他们对应的元素中的空白。letter-spacing添加字母之间的空白，而word-spacing添加每个单词之间的空白。在52CSS.com中有过相关介绍，请大家注意，word-spacing对中文无效。&nbsp;&nbsp;<br/><br/><strong>letter-spacing</strong><br/><br/>　　语法：<br/>　　letter-spacing&nbsp;:&nbsp;normal&nbsp;|&nbsp;length&nbsp;<br/>　　参数：<br/>　　normal&nbsp;:&nbsp;　默认间隔<br/>　　length&nbsp;:&nbsp;　由浮点数字和单位标识符组成的长度值，允许为负值。请参阅长度单位<br/>　　说明：<br/>　　检索或设置对象中的文字之间的间隔。<br/>　　该属性将指定的间隔添加到每个文字之后，但最后一个字将被排除在外。<br/>　　对应的脚本特性为letterSpacing。请参阅我编写的其他书目。<br/><br/>　　<a target="_blank" href="http://www.52css.com/css/c_letterspacing.html">http://www.52css.com/css/c_letterspacing.html</a><br/><br/><strong>word-spacing</strong><br/><br/>　　语法：<br/>　　word-spacing&nbsp;:&nbsp;normal&nbsp;|&nbsp;length&nbsp;<br/>　　参数：<br/>　　normal&nbsp;:&nbsp;　默认间距<br/>　　length&nbsp;:&nbsp;　由浮点数字和单位标识符组成的长度值，允许为负值。请参阅长度单位<br/>　　说明：<br/>　　检索或设置对象中的单词之间插入的空格数。对于IE4+而言仅在MAC平台上可用。<br/>　　对应的脚本特性为wordSpacing。请参阅我编写的其他书目。<br/><br/>　　<a target="_blank" href="http://www.52css.com/css/c_wordspacing.html">http://www.52css.com/css/c_wordspacing.html</a><br/>　　]]></summary>
	  <link rel="alternate" type="text/html" href="http://www.52css.com/default.asp?id=1157" /> 
	  <id>http://www.52css.com/default.asp?id=1157</id> 
  </entry>	
		
  <entry>
	  <title type="html"><![CDATA[CSS经验分享：书写高效CSS注意的七个方面]]></title>
	  <author>
		 <name>52css</name>
		 <uri>http://www.52css.com/</uri>
		 <email>MrJin@52css.com</email>
	  </author>
	  <category term="" scheme="http://www.52css.com/default.asp?cateID=3" label="Div+CSS教程" /> 
	  <updated>2010-01-31T21:56:15+08:00</updated>
	  <published>2010-01-31T21:56:15+08:00</published>
		  <summary type="html"><![CDATA[　　随着CSS网页布局的应用越来越广泛，更多的CSSer开始书写CSS，如何才能写出高效规范的CSS代码呢，今天52CSS.com向大家介绍，必须要注意的七个方面：<br/><br/>　　<strong>一、使用外联样式替代行间样式或者内嵌样式</strong>&nbsp;<br/><br/>　　不推荐使用行间样式<br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.52css.com/images/quote.gif" style="margin:0px 2px -3px 0px" alt="div css xhtml xml Example Source Code"/> Example Source Code <span style="font-weight:100;color:#f7f7f7;">[www.52css.com]</span></div><div class="UBBContent">&lt;!DOCTYPE&nbsp;html&nbsp;PUBLIC&nbsp;&#34;-//W3C//DTD&nbsp;XHTML&nbsp;1.0&nbsp;Transitional//EN&#34;&nbsp;&#34;<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" target="_blank">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</a>&#34;&gt;<br/>&lt;html&nbsp;xmlns=&#34;<a href="http://www.w3.org/1999/xhtml" target="_blank">http://www.w3.org/1999/xhtml</a>&#34;&gt;<br/>&lt;head&gt;<br/>&lt;meta&nbsp;http-equiv=&#34;Content-Type&#34;&nbsp;content=&#34;text/html;&nbsp;charset=utf-8&#34;&nbsp;/&gt;<br/>&lt;title&gt;Page&nbsp;title&nbsp;-&nbsp;52css.com&lt;/title&gt;<br/>&lt;/head&gt;&nbsp;<br/>&lt;body&gt;<br/>&lt;p&nbsp;style=&#34;color:&nbsp;red&#34;&gt;&nbsp;...&nbsp;&lt;/p&gt;&nbsp;<br/>&lt;/body&gt;&nbsp;<br/>&lt;/html&gt;&nbsp;</div></div><br/>　　不推荐使用内嵌样式<br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.52css.com/images/quote.gif" style="margin:0px 2px -3px 0px" alt="div css xhtml xml Example Source Code"/> Example Source Code <span style="font-weight:100;color:#f7f7f7;">[www.52css.com]</span></div><div class="UBBContent">&lt;!DOCTYPE&nbsp;HTML&nbsp;PUBLIC&nbsp;&#34;-//W3C//DTD&nbsp;HTML&nbsp;4.01//EN&#34;&nbsp;&#34;<a href="http://www.w3.org/TR/html4/strict.dtd" target="_blank">http://www.w3.org/TR/html4/strict.dtd</a>&#34;&gt;&nbsp;&lt;html&nbsp;lang=&#34;en&#34;&gt;&nbsp;<br/>&lt;head&gt;<br/>&lt;meta&nbsp;http-equiv=&#34;Content-Type&#34;&nbsp;content=&#34;text/html;&nbsp;charset=utf-8&#34;&nbsp;/&gt;<br/>&lt;title&gt;Page&nbsp;title&nbsp;-&nbsp;52css.com&lt;/title&gt;&nbsp;<br/>&lt;style&nbsp;type=&#34;text/css&#34;&nbsp;media=&#34;screen&#34;&gt;<br/>p&nbsp;{&nbsp;color:&nbsp;red;&nbsp;}&nbsp;<br/>&lt;/style&gt;&nbsp;<br/>&lt;/head&gt;&nbsp;<br/>&lt;body&gt;...&nbsp;&lt;/body&gt;&nbsp;<br/>&lt;/html&gt;&nbsp;</div></div><br/>　　推荐使用外联样式<br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.52css.com/images/quote.gif" style="margin:0px 2px -3px 0px" alt="div css xhtml xml Example Source Code"/> Example Source Code <span style="font-weight:100;color:#f7f7f7;">[www.52css.com]</span></div><div class="UBBContent">&lt;!DOCTYPE&nbsp;HTML&nbsp;PUBLIC&nbsp;&#34;-//W3C//DTD&nbsp;HTML&nbsp;4.01//EN&#34;&nbsp;&#34;<a href="http://www.w3.org/TR/html4/strict.dtd" target="_blank">http://www.w3.org/TR/html4/strict.dtd</a>&#34;&gt;<br/>&lt;html&nbsp;lang=&#34;en&#34;&gt;<br/>&lt;head&gt;&nbsp;<br/>&lt;meta&nbsp;http-equiv=&#34;content-type&#34;&nbsp;content=&#34;text&nbsp;<br/>&lt;title&gt;Page&nbsp;title&nbsp;-&nbsp;52css.com&lt;/title&gt;&nbsp;<br/>&lt;link&nbsp;rel=&#34;stylesheet&#34;&nbsp;href=&#34;name.css&#34;&nbsp;type=&#34;text/css&#34;&nbsp;media=&#34;screen&#34;&nbsp;/&gt;&nbsp;<br/>&lt;&nbsp;/head&gt;&nbsp;<br/>&lt;body&gt;&nbsp;...&nbsp;&lt;/body&gt;&nbsp;<br/>&lt;/html&gt;&nbsp;</div></div><br/>　　<strong>二、建议使用&nbsp;link&nbsp;引入外部样式表</strong><br/><br/>　　为了兼容老版本的浏览器，建议使用&nbsp;link&nbsp;引入外部样式表的方来代替&nbsp;@import导入样式的方式.&nbsp;<br/>译者注：&nbsp;@import是CSS2.1提出的所以老的浏览器不支持，点击查看&nbsp;@import的兼容性。<br/>　　@import和link在使用上会有一些区别，&nbsp;利用二者之间的差异，可以在实际运用中进行权衡。&nbsp;<br/>　　关于@import和link方式的比较在52CSS.com上有几篇文章可以拓展阅读。<br/>　　不推荐@import导入方式<br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.52css.com/images/quote.gif" style="margin:0px 2px -3px 0px" alt="div css xhtml xml Example Source Code"/> Example Source Code <span style="font-weight:100;color:#f7f7f7;">[www.52css.com]</span></div><div class="UBBContent">&lt;!DOCTYPE&nbsp;HTML&nbsp;PUBLIC&nbsp;&#34;-//W3C//DTD&nbsp;HTML&nbsp;4.01//EN&#34;&nbsp;&#34;<a href="http://www.w3.org/TR/html4/strict.dtd" target="_blank">http://www.w3.org/TR/html4/strict.dtd</a>&#34;&gt;&nbsp;<br/>&lt;html&nbsp;lang=&#34;en&#34;&gt;<br/>&lt;head&gt;&nbsp;<br/>&lt;meta&nbsp;http-equiv=&#34;content-type&#34;&nbsp;content=&#34;text&nbsp;<br/>&lt;title&gt;Page&nbsp;title&nbsp;-&nbsp;52css.com&lt;/title&gt;&nbsp;<br/>&lt;style&nbsp;type=&#34;text/css&#34;&nbsp;media=&#34;screen&#34;&gt;&nbsp;<br/>@import&nbsp;url(&#34;styles.css&#34;);<br/>&lt;/style&gt;<br/>&lt;/head&gt;<br/>&lt;body&gt;&nbsp;...&nbsp;&lt;/body&gt;<br/>&lt;/html&gt;&nbsp;</div></div><br/>　　推荐引入外部样式表方式<br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.52css.com/images/quote.gif" style="margin:0px 2px -3px 0px" alt="div css xhtml xml Example Source Code"/> Example Source Code <span style="font-weight:100;color:#f7f7f7;">[www.52css.com]</span></div><div class="UBBContent">&lt;!DOCTYPE&nbsp;HTML&nbsp;PUBLIC&nbsp;&#34;-//W3C//DTD&nbsp;HTML&nbsp;4.01//EN&#34;&nbsp;&#34;<a href="http://www.w3.org/TR/html4/strict.dtd" target="_blank">http://www.w3.org/TR/html4/strict.dtd</a>&#34;&gt;&nbsp;&lt;html&nbsp;lang=&#34;en&#34;&gt;&nbsp;&lt;head&gt;<br/>&lt;meta&nbsp;http-equiv=&#34;content-type&#34;&nbsp;content=&#34;text&nbsp;<br/>&lt;title&gt;Page&nbsp;title&nbsp;-&nbsp;52css.com&lt;/title&gt;<br/>&lt;link&nbsp;rel=&#34;stylesheet&#34;&nbsp;href=&#34;name.css&#34;&nbsp;type=&#34;text/css&#34;&nbsp;media=&#34;screen&#34;&nbsp;/&gt;<br/>&lt;/head&gt;&nbsp;<br/>&lt;body&gt;&nbsp;...&nbsp;&lt;/body&gt;&nbsp;<br/>&lt;/html&gt;</div></div><br/>　　<strong>三、使用继承&nbsp;</strong><br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.52css.com/images/quote.gif" style="margin:0px 2px -3px 0px" alt="div css xhtml xml Example Source Code"/> Example Source Code <span style="font-weight:100;color:#f7f7f7;">[www.52css.com]</span></div><div class="UBBContent">低效率的<br/>p{&nbsp;font-family:&nbsp;arial,&nbsp;helvetica,&nbsp;sans-serif;&nbsp;}<br/>#container&nbsp;{&nbsp;font-family:&nbsp;arial,&nbsp;helvetica,&nbsp;sans-serif;&nbsp;}<br/>#navigation&nbsp;{&nbsp;font-family:&nbsp;arial,&nbsp;helvetica,&nbsp;sans-serif;&nbsp;}<br/>#content&nbsp;{&nbsp;font-family:&nbsp;arial,&nbsp;helvetica,&nbsp;sans-serif;&nbsp;}<br/>#sidebar&nbsp;{&nbsp;font-family:&nbsp;arial,&nbsp;helvetica,&nbsp;sans-serif;&nbsp;}<br/>h1&nbsp;{&nbsp;font-family:&nbsp;georgia,&nbsp;times,&nbsp;serif;&nbsp;}&nbsp;<br/>高效的<br/>body&nbsp;{&nbsp;font-family:&nbsp;arial,&nbsp;helvetica,&nbsp;sans-serif;&nbsp;}&nbsp;<br/>body&nbsp;{&nbsp;font-family:&nbsp;arial,&nbsp;helvetica,&nbsp;sans-serif;&nbsp;}<br/>h1&nbsp;{&nbsp;font-family:&nbsp;georgia,&nbsp;times,&nbsp;serif;&nbsp;}&nbsp;</div></div><br/>　　<strong>四、使用多重选择器&nbsp;</strong><br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.52css.com/images/quote.gif" style="margin:0px 2px -3px 0px" alt="div css xhtml xml Example Source Code"/> Example Source Code <span style="font-weight:100;color:#f7f7f7;">[www.52css.com]</span></div><div class="UBBContent">低效率的&nbsp;<br/>h1&nbsp;{&nbsp;color:&nbsp;#236799;&nbsp;}&nbsp;<br/>h2&nbsp;{&nbsp;color:&nbsp;#236799;&nbsp;}<br/>h3&nbsp;{&nbsp;color:&nbsp;#236799;&nbsp;}<br/>h4&nbsp;{&nbsp;color:&nbsp;#236799;&nbsp;}&nbsp;<br/>高效的<br/>h1,&nbsp;h2,&nbsp;h3,&nbsp;h4&nbsp;{&nbsp;color:&nbsp;#236799;&nbsp;}&nbsp;</div></div><br/>　　<strong>五、使用多重声明</strong><br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.52css.com/images/quote.gif" style="margin:0px 2px -3px 0px" alt="div css xhtml xml Example Source Code"/> Example Source Code <span style="font-weight:100;color:#f7f7f7;">[www.52css.com]</span></div><div class="UBBContent">低效率的<br/>p&nbsp;{&nbsp;margin:&nbsp;0&nbsp;0&nbsp;1em;&nbsp;}<br/>p&nbsp;{&nbsp;background:&nbsp;#ddd;&nbsp;}<br/>p&nbsp;{&nbsp;color:&nbsp;#666;&nbsp;}&nbsp;<br/>译者注：&nbsp;对于十六进制颜色值，个人偏向于色值不缩写且英文字母要大写的方式.&nbsp;<br/>高效的<br/>p&nbsp;{&nbsp;margin:&nbsp;0&nbsp;0&nbsp;1em;&nbsp;background:&nbsp;#ddd;&nbsp;color:&nbsp;#666;&nbsp;}&nbsp;</div></div><br/>　　<strong>六、使用简记属性</strong>&nbsp;<br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.52css.com/images/quote.gif" style="margin:0px 2px -3px 0px" alt="div css xhtml xml Example Source Code"/> Example Source Code <span style="font-weight:100;color:#f7f7f7;">[www.52css.com]</span></div><div class="UBBContent">低效率的&nbsp;<br/>body&nbsp;{&nbsp;font-size:&nbsp;85%;&nbsp;font-family:&nbsp;arial,&nbsp;helvetica,&nbsp;sans-serif;&nbsp;background-image:&nbsp;url(image.gif);&nbsp;background-repeat:&nbsp;no-repeat;&nbsp;background-position:&nbsp;0&nbsp;100%;&nbsp;margin-top:&nbsp;1em;&nbsp;margin-right:&nbsp;1em;&nbsp;margin-bottom:&nbsp;0;&nbsp;margin-left:&nbsp;1em;&nbsp;padding-top:&nbsp;10px;&nbsp;padding-right:&nbsp;10px;&nbsp;padding-bottom:&nbsp;10px;&nbsp;padding-left:&nbsp;10px;&nbsp;border-style:&nbsp;solid;&nbsp;border-width:&nbsp;1px;&nbsp;border-color:&nbsp;red;&nbsp;color:&nbsp;#222222;&nbsp;<br/>高效的&nbsp;<br/>body&nbsp;{&nbsp;font:&nbsp;85%&nbsp;arial,&nbsp;helvetica,&nbsp;sans-serif;&nbsp;background:&nbsp;url(image.gif)&nbsp;no-repeat&nbsp;0&nbsp;100%;&nbsp;margin:&nbsp;1em&nbsp;1em&nbsp;0;&nbsp;padding:&nbsp;10px;&nbsp;border:&nbsp;1px&nbsp;solid&nbsp;red;&nbsp;color:&nbsp;#222;&nbsp;}&nbsp;</div></div><br/>　　<strong>七、避免使用&nbsp;!important</strong>&nbsp;<br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.52css.com/images/quote.gif" style="margin:0px 2px -3px 0px" alt="div css xhtml xml Example Source Code"/> Example Source Code <span style="font-weight:100;color:#f7f7f7;">[www.52css.com]</span></div><div class="UBBContent">慎用写法<br/>#news&nbsp;{&nbsp;background:&nbsp;#ddd&nbsp;!important;&nbsp;}&nbsp;<br/>特定情况下可以使用以下方式提高权重级别<br/>#container&nbsp;#news&nbsp;{&nbsp;background:&nbsp;#ddd;&nbsp;}<br/>body&nbsp;#container&nbsp;#news&nbsp;{&nbsp;background:&nbsp;#ddd;&nbsp;}</div></div>&nbsp;<br/>　　那么，如何让（后续）维护你站点的人更容易理解你的样式代码呢？&nbsp;我们在52CSS.com以后的文章中和大家共同讨论学习。<br/>　　]]></summary>
	  <link rel="alternate" type="text/html" href="http://www.52css.com/default.asp?id=1156" /> 
	  <id>http://www.52css.com/default.asp?id=1156</id> 
  </entry>	
		
  <entry>
	  <title type="html"><![CDATA[CSS技巧：关于CSS Hack与float闭合（清除浮动）]]></title>
	  <author>
		 <name>52css</name>
		 <uri>http://www.52css.com/</uri>
		 <email>MrJin@52css.com</email>
	  </author>
	  <category term="" scheme="http://www.52css.com/default.asp?cateID=3" label="Div+CSS教程" /> 
	  <updated>2010-01-28T21:28:23+08:00</updated>
	  <published>2010-01-28T21:28:23+08:00</published>
		  <summary type="html"><![CDATA[<strong>一、CSS&nbsp;HACK</strong><br/><br/>　　以下两种方法几乎能解决现今所有HACK.<br/>　　1,&nbsp;!important<br/>　　随着IE7对!important的支持,&nbsp;!important&nbsp;方法现在只针对IE6的HACK.(注意写法.记得该声明位置需要提前.)<br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.52css.com/images/quote.gif" style="margin:0px 2px -3px 0px" alt="div css xhtml xml Example Source Code"/> Example Source Code <span style="font-weight:100;color:#f7f7f7;">[www.52css.com]</span></div><div class="UBBContent">&lt;style&gt;<br/>#wrapper<br/>{<br/>width:&nbsp;100px!important;<br/>width:&nbsp;80px;<br/>}<br/>&lt;/style&gt;</div></div><br/>　　2,&nbsp;IE6/IE77对FireFox<br/>　　*+html&nbsp;与&nbsp;*html&nbsp;是IE特有的标签,&nbsp;firefox&nbsp;暂不支持.而*+html&nbsp;又为&nbsp;IE7特有标签.<br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.52css.com/images/quote.gif" style="margin:0px 2px -3px 0px" alt="div css xhtml xml Example Source Code"/> Example Source Code <span style="font-weight:100;color:#f7f7f7;">[www.52css.com]</span></div><div class="UBBContent">&lt;style&gt;<br/>#wrapper<br/>{<br/>#wrapper&nbsp;{&nbsp;width:&nbsp;120px;&nbsp;}<br/>*html&nbsp;#wrapper&nbsp;{&nbsp;width:&nbsp;80px;}<br/>*+html&nbsp;#wrapper&nbsp;{&nbsp;width:&nbsp;60px;}<br/>}<br/>&lt;/style&gt;</div></div><br/>　　注意:<br/>　　*+html&nbsp;对IE7的HACK&nbsp;必须保证HTML顶部有如下声明：<br/>　　&lt;!DOCTYPE&nbsp;HTML&nbsp;PUBLIC&nbsp;&#34;-//W3C//DTD&nbsp;HTML&nbsp;4.01&nbsp;Transitional//EN&#34;　&#34;&#34;&gt;<br/><br/><strong>二、float&nbsp;闭合（清除浮动）</strong><br/><br/>　　将以下代码加入Global&nbsp;CSS&nbsp;中,给需要闭合的div加上&nbsp;class=&#34;clearfix&#34;&nbsp;即可,屡试不爽.<br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.52css.com/images/quote.gif" style="margin:0px 2px -3px 0px" alt="div css xhtml xml Example Source Code"/> Example Source Code <span style="font-weight:100;color:#f7f7f7;">[www.52css.com]</span></div><div class="UBBContent">&lt;style&gt;<br/>.clearfix:after<br/>{<br/>content:&#34;.&#34;;<br/>display:block;<br/>height:0;<br/>clear:both;<br/>visibility:hidden;<br/>}<br/>.clearfix<br/>{<br/>display:inline-block;<br/>}<br/>.clearfix&nbsp;{display:block;}<br/>&lt;/style&gt;</div></div><br/>　　]]></summary>
	  <link rel="alternate" type="text/html" href="http://www.52css.com/default.asp?id=1155" /> 
	  <id>http://www.52css.com/default.asp?id=1155</id> 
  </entry>	
		
  <entry>
	  <title type="html"><![CDATA[至CSS新手：CSS网页布局的常用规范]]></title>
	  <author>
		 <name>52css</name>
		 <uri>http://www.52css.com/</uri>
		 <email>MrJin@52css.com</email>
	  </author>
	  <category term="" scheme="http://www.52css.com/default.asp?cateID=3" label="Div+CSS教程" /> 
	  <updated>2010-01-26T23:21:03+08:00</updated>
	  <published>2010-01-26T23:21:03+08:00</published>
		  <summary type="html"><![CDATA[CSS命名规范<br/><br/>一．文件命名规范<br/><br/>全局样式：global.css；<br/>框架布局：layout.css；<br/>字体样式：font.css；<br/>链接样式：link.css；<br/>打印样式：print.css；<br/><br/>二．常用类/ID命名规范<br/><br/>页　眉：header<br/>内　容：content<br/>容　器：container<br/>页　脚：footer<br/>版　权：copyright　<br/>导　航：menu<br/>主导航：mainMenu<br/>子导航：subMenu<br/>标　志：logo<br/>标　语：banner<br/>标　题：title<br/>侧边栏：sidebar<br/>图　标：Icon<br/>注　释：note<br/>搜　索：search<br/>按　钮：btn<br/>登　录：login<br/>链　接：link<br/>信息框：manage<br/>……<br/><br/>常用类的命名应尽量以常见英文单词为准，做到通俗易懂，并在适当的地方加以注释。对于二级类/ID命名，则采用组合书写的模式，后一个单词的首字母应大写：诸如“搜索框”则应命名为“searchInput”、“搜索图标”命名这“searchIcon”、“搜索按钮”命名为“searchBtn<br/><br/>CSS书写规范及方法<br/><br/>一.&nbsp;常规书写规范及方法<br/><br/>1.&nbsp;选择DOCTYPE：<br/><br/>XHTML&nbsp;1.0&nbsp;提供了三种DTD声明可供选择：<br/><br/>过渡的(Transitional):要求非常宽松的DTD，它允许你继续使用HTML4.01的标识(但是要符合xhtml的写法)。完整代码如下：<br/><br/>&lt;!DOCTYPE&nbsp;html&nbsp;PUBLIC&nbsp;“-//W3C//DTD&nbsp;XHTML&nbsp;1.0&nbsp;Transitional//EN”&nbsp;“<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" target="_blank">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</a>“&gt;<br/><br/>严格的(Strict):要求严格的DTD，你不能使用任何表现层的标识和属性，例如&lt;br&gt;。完整代码如下：<br/><br/>&lt;!DOCTYPE&nbsp;html&nbsp;PUBLIC&nbsp;“-//W3C//DTD&nbsp;XHTML&nbsp;1.0&nbsp;Strict//EN”&nbsp;“<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" target="_blank">http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</a>“&gt;<br/><br/>框架的(Frameset):专门针对框架页面设计使用的DTD，如果你的页面中包含有框架，需要采用这种DTD。完整代码如下：<br/><br/>&lt;!DOCTYPE&nbsp;html&nbsp;PUBLIC&nbsp;“-//W3C//DTD&nbsp;XHTML&nbsp;1.0&nbsp;Frameset//EN”&nbsp;“<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd" target="_blank">http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd</a>“&gt;<br/><br/>理想情况当然是严格的DTD，但对于我们大多数刚接触web标准的设计师来说，过渡的DTD(XHTML&nbsp;1.0&nbsp;Transitional)是目前理想选择(包括本站，使用的也是过渡型DTD)。因为这种DTD还允许我们使用表现层的标识、元素和属性，也比较容易通过W3C的代码校验。<br/><br/>2.&nbsp;指定语言及字符集：<br/><br/>为文档指定语言：<br/><br/>&lt;html&nbsp;xmlns=”<a href="http://www.w3.org/1999/xhtml" target="_blank">http://www.w3.org/1999/xhtml</a>”&nbsp;lang=”en”&gt;<br/><br/>为了被浏览器正确解释和通过W3C代码校验，所有的XHTML文档都必须声明它们所使用的编码语言；如：<br/>常用的语言定义：<br/><br/>&lt;meta&nbsp;http-equiv=”Content-Type”&nbsp;content=”text/html;&nbsp;charset=utf-8″&nbsp;/&gt;<br/>标准的XML文档语言定义：<br/>&lt;?xml&nbsp;version=”1.0″&nbsp;encoding=”&nbsp;utf-8″?&gt;<br/>针对老版本的浏览器的语言定义：<br/>&lt;meta&nbsp;http-equiv=”Content-Language”&nbsp;content=”&nbsp;utf-8″&nbsp;/&gt;<br/>为提高字符集，建议采用“utf-8”。<br/><br/>3.&nbsp;调用样式表：<br/><br/>外部样式表调用：<br/><br/>页面内嵌法：就是将样式表直接写在页面代码的head区。&nbsp;如：<br/><br/>&lt;style&nbsp;type=”text/css”&gt;&lt;!–&nbsp;body&nbsp;{&nbsp;background&nbsp;:&nbsp;white&nbsp;;&nbsp;color&nbsp;:&nbsp;black&nbsp;;&nbsp;}&nbsp;–&gt;&nbsp;&lt;/style&gt;<br/>外部调用法：将样式表写在一个独立的.css文件中，然后在页面head区用类似以下代码调用。<br/><br/>&lt;link&nbsp;rel=”stylesheet”&nbsp;rev=”stylesheet”&nbsp;href=”css/style.css”&nbsp;type=”text/css”&nbsp;media=”all”&nbsp;/&gt;<br/><br/>在符合web标准的设计中，推荐使用外部调用法，可以不修改页面只修改.css文件而改变页面的样式。如果所有页面都调用同一个样式表文件，那么改一个样式表文件，可以改变所有文件的样式。<br/><br/>4、选用恰当的元素：<br/><br/>根据文档的结构来选择HTML元素，而不是根据HTML元素的样式来选择。例如，使用P元素来包含文字段落，而不是为了换行。如果在创建文档时找不到适当的元素，则可以考虑使用通用的div&nbsp;或者是span；<br/><br/>避免过渡使用div和span。少量、适当的使用div和span元素可以使文档的结构更加清晰合理并且易于使用样式；<br/><br/>尽可能少地使用标签和结构嵌套，这样不但可以使文档结构清晰，同时也可以保持文件的小巧，在提高用户下载速度的同时，也易于浏览器对文档的解释及呈视；<br/><br/>5、派生选择器：<br/><br/>可以使用派生选择器给一个元素里的子元素定义样式，在简化命名的同时也使结构更加的清晰化，如：<br/><br/>.mainMenu&nbsp;ul&nbsp;li&nbsp;{background:url(images/bg.gif;)}<br/><br/>6、辅助图片用背影图处理：<br/><br/>这里的”辅助图片”是指那些不是作为页面要表达的内容的一部分，而仅仅用于修饰、间隔、提醒的图片。将其做背影图处理，可以在不改动页面的情况下通过CSS样式来进行改动，如：<br/><br/>#logo&nbsp;{background:url(images/logo.jpg)&nbsp;#FEFEFE&nbsp;no-repeat&nbsp;right&nbsp;bottom;}<br/><br/>7、结构与样式分离：<br/><br/>在页面里只写入文档的结构，而将样式写于css文件中，通过外部调用CSS样式表来实现结构与样式的分离。<br/><br/>8、文档的结构化书写：<br/><br/>页面CSS文档都应采用结构化的书写方式，逻辑清晰易于阅读。如：<br/><br/>&lt;div&nbsp;id=”mainMenu”&gt;<br/>&lt;ul&gt;<br/>&lt;li&gt;&lt;a&nbsp;href=”#”&nbsp;&gt;首页&lt;/a&gt;&lt;/li&gt;<br/>&lt;li&gt;&lt;a&nbsp;href=”#”&nbsp;&gt;介绍&lt;/a&gt;&lt;/li&gt;<br/>&lt;li&gt;&lt;a&nbsp;href=”#”&nbsp;&gt;服务&lt;/a&gt;&lt;/li&gt;<br/>&lt;/ul&gt;<br/>&lt;/div&gt;<br/><br/>/*=====主导航=====*/<br/>#mainMenu&nbsp;{<br/>width:100%;<br/>height:30px;<br/>background:url(images/mainMenu_bg.jpg)&nbsp;repeat-x;<br/>}<br/>#mainMenu&nbsp;ul&nbsp;li&nbsp;{<br/>float:left;<br/>line-height:30px;<br/>margin-right:1px;<br/>cursor:pointer;<br/>}<br/>/*=====主导航结束=====*/<br/><br/>9、鼠标手势：<br/><br/>在XHTML标准中，hand只被IE识别，当需要将鼠标手势转换为“手形”时，则将“hand”换为“pointer”，即“cursor:pointer;”<br/><br/>二．注释书写规范<br/><br/>1、行间注释：<br/><br/>直接写于属性值后面，如：<br/><br/>.search{<br/>border:1px&nbsp;solid&nbsp;#fff;/*定义搜索输入框边框*/<br/>background:url(../images/icon.gif)&nbsp;no-report&nbsp;#333;/*定义搜索框的背景*/<br/>}<br/><br/>2、整段注释：<br/><br/>分别在开始及结束地方加入注释，如：<br/><br/>/*=====搜索条=====*/<br/>.search&nbsp;{<br/>border:1px&nbsp;solid&nbsp;#fff;<br/>background:url(../images/icon.gif)&nbsp;no-repeat&nbsp;#333;<br/>}<br/>/*=====搜索条结束=====*/<br/><br/>三．样式属性代码缩写<br/><br/>1、不同类有相同属性及属性值的缩写：<br/><br/>对于两个不同的类，但是其中有部分相同甚至是全部相同的属性及属性值时，应对其加以合并缩写，特别是当有多个不同的类而有相同的属性及属性值时，合并缩写可以减少代码量并易于控制。如：<br/><br/>#mainMenu&nbsp;{<br/>background:url(../images/bg.gif);<br/>border:1px&nbsp;solid&nbsp;#333;<br/>width:100%;<br/>height:30px;<br/>overflow:hidden;<br/>}<br/>#subMenu&nbsp;{<br/>background:url(../images/bg.gif);<br/>border:1px&nbsp;solid&nbsp;#333;<br/>width:100%;<br/>height:20px;<br/>overflow:hidden;<br/>}<br/><br/>两个不同类的属性值有重复之处，刚可以缩写为：<br/><br/>#mainMenu,#subMenu&nbsp;{<br/>background:url(../images/bg.gif);<br/>border:1px&nbsp;solid&nbsp;#333;<br/>width:100%;<br/>overflow:hidden;<br/>}<br/>#mainMenu&nbsp;{height:30px;}<br/>#subMenu&nbsp;{height:20px;}<br/><br/>2、同一属性的缩写：<br/><br/>同一属性根据它的属性值也可以进行简写，如：<br/><br/>.search&nbsp;{<br/>background-color:#333;<br/>background-image:url(../images/icon.gif);<br/>background-repeat:&nbsp;no-repeat;<br/>background-position:50%&nbsp;50%;<br/>}<br/>.search&nbsp;{<br/>background:#333&nbsp;url(../images/icon.gif)&nbsp;no-repeat&nbsp;50%&nbsp;50%;<br/>}<br/><br/>3、内外侧边框的缩写：<br/><br/>在CSS中关于内外侧边框的距离是按照上、右、下、左的顺序来排列的，当这四个属性值不同时也可直接缩写，如：<br/><br/>.btn&nbsp;{<br/>margin-top:10px;<br/>margin-right:8px;<br/>margin-bottom:12px;<br/>margin-left:5px;<br/>padding-top:10px;<br/>padding-right:8px;<br/>padding-bottom:12px;<br/>padding-left:8px;<br/>}<br/><br/>则可缩写为：<br/><br/>.btn&nbsp;{<br/>Margin:10px&nbsp;8px&nbsp;12px&nbsp;5px;<br/>Padding:10px&nbsp;8px&nbsp;12px&nbsp;5px;<br/>}<br/><br/>而如果当上边与下边、左边与右边的边框属性值相同时，则属性值可以直接缩写为两个，如：<br/><br/>.btn&nbsp;{<br/>margin-top:10px;<br/>margin-right:5px;<br/>margin-bottom:10px;<br/>margin-left:5px;<br/>}<br/><br/>缩写为：<br/><br/>.btn&nbsp;{margin:10px&nbsp;5px;}<br/><br/>而当上下左右四个边框的属性值都相同时，则可以直接缩写成一个，如：<br/><br/>.btn&nbsp;{<br/>margin-top:10px;<br/>margin-right:10px;<br/>margin-bottom:10px;<br/>margin-left:10px;<br/>}<br/><br/>缩写为：<br/><br/>.btn{margin:10px;}<br/><br/>4、颜色值的缩写：<br/><br/>当RGB三个颜色值数值相同时，可缩写颜色值代码。如：<br/><br/>.menu&nbsp;{&nbsp;color:#ff3333;}<br/><br/>可缩写为:<br/><br/>.menu&nbsp;{color:#f33;}<br/><br/>四．hack书写规范&nbsp;<br/><br/>因为不同浏览器对W3C标准的支持不一样，各个浏览器对于页面的解释呈视也不尽相同，比如IE在很多情况下就与FF存在3px的差距，对于这些差异性，就需要利用css&nbsp;的hack来进行调整，当然在没有必要的情况下，最好不要写hack来进行调整，避免因为hack而导致页面出现问题。<br/><br/>1、&nbsp;IE6、IE7、Firefox之间的兼容写法：<br/><br/>写法一：<br/><br/>IE都能识别*;标准浏览器(如FF)不能识别*；<br/>IE6能识别*，但不能识别&nbsp;!important,<br/>IE7能识别*，也能识别!important;<br/>FF不能识别*，但能识别!important;<br/>根据上述表达，同一类/ID下的CSS&nbsp;　hack可写为：<br/>.searchInput&nbsp;{<br/>background-color:#333;/*三者皆可*/<br/>*background-color:#666　!important;&nbsp;/*仅IE7*/<br/>*background-color:#999;&nbsp;/*仅IE6及IE6以下*/<br/>}<br/>一般三者的书写顺序为：FF、IE7、IE6.<br/><br/>写法二：<br/><br/>IE6可识别“_”，而IE7及FF皆不能识别，所以当只针对IE6与IE7及FF之间的区别时，可这样书写：<br/>.searchInput&nbsp;{<br/>background-color:#333;/*通用*/<br/>_background-color:#666;/*仅IE6可识别*/<br/>}<br/><br/>写法三：<br/><br/>*+html&nbsp;与&nbsp;*html&nbsp;是IE特有的标签,&nbsp;Firefox&nbsp;暂不支持。<br/>.searchInput&nbsp;{background-color:#333;}<br/>*html&nbsp;.searchInput&nbsp;{background-color:#666;}/*仅IE6*/<br/>*+html&nbsp;.searchInput&nbsp;{background-color:#555;}/*仅IE7*/<br/><br/>屏蔽IE浏览器：<br/><br/>sel&#101;ct是选择符，根据情况更换。第二句是MAC上safari浏览器独有的。<br/><br/>*:lang(zh)&nbsp;sel&#101;ct&nbsp;{font:12px&nbsp;&nbsp;!important;}&nbsp;/*FF的专用*/<br/>sel&#101;ct:empty&nbsp;{font:12px&nbsp;&nbsp;!important;}&nbsp;/*safari可见*/<br/><br/>IE6可识别：<br/><br/>这里主要是通过CSS注释分开一个属性与值，注释在冒号前。<br/><br/>sel&#101;ct&nbsp;{&nbsp;display&nbsp;/*IE6不识别*/:none;}<br/><br/>IE的if条件hack写法：<br/><br/>所有的IE可识别：<br/><br/>&lt;!–[if&nbsp;IE]&gt;&nbsp;Only&nbsp;IE&nbsp;&lt;![end&nbsp;if]–&gt;<br/>只有IE5.0可以识别:<br/>&lt;!–[if&nbsp;IE&nbsp;5.0]&gt;&nbsp;Only&nbsp;IE&nbsp;5.0&nbsp;&lt;![end&nbsp;if]–&gt;<br/>IE5.0包换IE5.5都可以识别:<br/>&lt;!–[if&nbsp;gt&nbsp;IE&nbsp;5.0]&gt;&nbsp;Only&nbsp;IE&nbsp;5.0+&nbsp;&lt;![end&nbsp;if]–&gt;<br/>仅IE6可识别:<br/>&lt;!–[if&nbsp;lt&nbsp;IE&nbsp;6]&gt;&nbsp;Only&nbsp;IE&nbsp;6-&nbsp;&lt;![end&nbsp;if]–&gt;<br/>IE6以及IE6以下的IE5.x都可识别:<br/>&lt;!–[if&nbsp;gte&nbsp;IE&nbsp;6]&gt;&nbsp;Only&nbsp;IE&nbsp;6/+&nbsp;&lt;![end&nbsp;if]–&gt;<br/>仅IE7可识别:<br/>&lt;!–[if&nbsp;lte&nbsp;IE&nbsp;7]&gt;&nbsp;Only&nbsp;IE&nbsp;7/-&nbsp;&lt;![end&nbsp;if]–&gt;<br/><br/>2、清除浮动：<br/><br/>在Firefox中，当子级都为浮动时，那么父级的高度就无法完全的包住整个子级，那么这时用这个清除浮动的HACK来对父级做一次定义，那么就可以解决这个问题。<br/><br/>sel&#101;ct:after&nbsp;{<br/>content:”.”;<br/>display:block;<br/>height:0;<br/>clear:both;<br/>visibility:hidden;<br/>}<br/><br/>———————–分割线———————<br/>]]></summary>
	  <link rel="alternate" type="text/html" href="http://www.52css.com/default.asp?id=1154" /> 
	  <id>http://www.52css.com/default.asp?id=1154</id> 
  </entry>	
		
  <entry>
	  <title type="html"><![CDATA[您需要了解的DIVCSS网页布局的8条面试题目]]></title>
	  <author>
		 <name>52css</name>
		 <uri>http://www.52css.com/</uri>
		 <email>MrJin@52css.com</email>
	  </author>
	  <category term="" scheme="http://www.52css.com/default.asp?cateID=3" label="Div+CSS教程" /> 
	  <updated>2010-01-24T20:49:08+08:00</updated>
	  <published>2010-01-24T20:49:08+08:00</published>
		  <summary type="html"><![CDATA[　　CSSer与其他IT职位一样，在找工作的时候，都会面临着面试官提出的问题，或者给出的试卷。今天52CSS.com收集了常见的8条面试题目，希望对您有所帮助。<br/><br/><strong>一、超链接点击过后hover样式就不出现的问题？</strong><br/><br/>　　被点击访问过的超链接样式不再具有hover和active样式了,解决方法是改变CSS属性的排列顺序:&nbsp;L-V-H-A<br/><br/><strong>二、IE6的margin双倍边距bug问题</strong><br/><br/>　　例如：<br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.52css.com/images/quote.gif" style="margin:0px 2px -3px 0px" alt="div css xhtml xml Example Source Code"/> Example Source Code <span style="font-weight:100;color:#f7f7f7;">[www.52css.com]</span></div><div class="UBBContent">&lt;style&nbsp;type=&#34;text/css&#34;&gt;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;body&nbsp;{margin:0;}&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;div&nbsp;{float:left;&nbsp;margin-left:10px;&nbsp;width:200px;&nbsp;height:200px;&nbsp;border:1px&nbsp;solid&nbsp;red;}&nbsp;<br/>&lt;/style&gt;&nbsp;</div></div><br/>　　浮动后本来外边距10px,但IE解释为20px,解决办法是加上display:inline<br/><br/><strong>三、为什么中火狐浏览器下文本无法撑开容器的高度？</strong><br/><br/>　　标准浏览器中固定高度值的容器是不会象IE6里那样被撑开的,那我又想固定高度，又想能被撑开需要怎样设置呢？办法就是去掉height设置min-height:200px;&nbsp;这里为了照顾不认识min-height的IE6&nbsp;可以这样定义：<br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.52css.com/images/quote.gif" style="margin:0px 2px -3px 0px" alt="div css xhtml xml Example Source Code"/> Example Source Code <span style="font-weight:100;color:#f7f7f7;">[www.52css.com]</span></div><div class="UBBContent">div&nbsp;{&nbsp;height:auto!important;&nbsp;height:200px;&nbsp;min-height:200px;&nbsp;}&nbsp;</div></div><br/><strong>四、为什么web标准中无法设置IE浏览器滚动条颜色了？</strong><br/><br/>　　原来样式设置：<br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.52css.com/images/quote.gif" style="margin:0px 2px -3px 0px" alt="div css xhtml xml Example Source Code"/> Example Source Code <span style="font-weight:100;color:#f7f7f7;">[www.52css.com]</span></div><div class="UBBContent">&lt;style&nbsp;type=&#34;text/css&#34;&gt;&nbsp;&nbsp;<br/>body&nbsp;{&nbsp;scrollbar-face-color:#f6f6f6;&nbsp;scrollbar-highlight-color:#fff;&nbsp;scrollbar-shadow-color:#eeeeee;&nbsp;scrollbar-3dlight-color:#eeeeee;&nbsp;scrollbar-arrow-color:#000;&nbsp;scrollbar-track-color:#fff;&nbsp;scrollbar-darkshadow-color:#fff;&nbsp;}&nbsp;&nbsp;&nbsp;<br/>&lt;/style&gt;</div></div>&nbsp;<br/>　　解决办法是将body换成html<br/>&nbsp;<br/><strong>五、如何定义1px左右高度的容器？</strong><br/>　　<br/>　　IE6下这个问题是因为默认的行高造成的，解决的方法也有很多，例如：overflow:hidden&nbsp;|&nbsp;zoom:0.08&nbsp;|&nbsp;line-height:1px<br/>&nbsp;<br/><strong>六、怎么样才能让层显示在FLASH之上呢？</strong><br/>　　<br/>　　解决的办法是给FLASH设置透明:<br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.52css.com/images/quote.gif" style="margin:0px 2px -3px 0px" alt="div css xhtml xml Example Source Code"/> Example Source Code <span style="font-weight:100;color:#f7f7f7;">[www.52css.com]</span></div><div class="UBBContent">&lt;a&nbsp;href=&#34;<a href="http://www.csschina.net/" target="_blank">http://www.csschina.net/</a>&#34;&gt;:&lt;/a&gt;&nbsp;<br/>&lt;pre&nbsp;lang=&#34;html&#34;&nbsp;line=&#34;1&#34;&gt;&nbsp;<br/>&lt;param&nbsp;name=&#34;wmode&#34;&nbsp;value=&#34;transparent&#34;&nbsp;/&gt;&nbsp;</div></div><br/>　　注：在52CSS.com中有专门讨论此问题的文章，大家可以搜索一下。<br/>　　<a target="_blank" href="http://www.52css.com/search.asp?SearchContent=flash&amp;searchType=title">http://www.52css.com/search.asp?SearchContent=flash&amp;searchType=title</a><br/><br/><strong>七、怎样使一个div层居中于浏览器中？</strong><br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.52css.com/images/quote.gif" style="margin:0px 2px -3px 0px" alt="div css xhtml xml Example Source Code"/> Example Source Code <span style="font-weight:100;color:#f7f7f7;">[www.52css.com]</span></div><div class="UBBContent">&lt;style&nbsp;type=&#34;text/css&#34;&gt;&nbsp;<br/>&lt;!--&nbsp;&nbsp;&nbsp;<br/>div&nbsp;{&nbsp;&nbsp;&nbsp;<br/>position:absolute;&nbsp;&nbsp;&nbsp;<br/>top:50%;&nbsp;&nbsp;&nbsp;<br/>left:50%;&nbsp;&nbsp;&nbsp;<br/>margin:-100px&nbsp;0&nbsp;0&nbsp;-100px;&nbsp;&nbsp;&nbsp;<br/>width:200px;&nbsp;&nbsp;&nbsp;<br/>height:200px;&nbsp;&nbsp;&nbsp;<br/>border:1px&nbsp;solid&nbsp;red;&nbsp;&nbsp;&nbsp;<br/>}&nbsp;&nbsp;&nbsp;<br/>--&gt;&nbsp;&nbsp;<br/>&lt;/style&gt;&nbsp;</div></div><br/>　　这里使用百分比绝对定位，与外补丁负值的方法，负值的大小为其自身宽度高度除以二<br/><br/><strong>八、firefox浏览器中嵌套div标签的居中问题的解决方法</strong><br/><br/>　　假定有如下情况：<br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.52css.com/images/quote.gif" style="margin:0px 2px -3px 0px" alt="div css xhtml xml Example Source Code"/> Example Source Code <span style="font-weight:100;color:#f7f7f7;">[www.52css.com]</span></div><div class="UBBContent">&lt;div&nbsp;id=&#34;a&#34;&gt;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;div&nbsp;id=&#34;b&#34;&gt;&nbsp;&lt;/div&gt;&nbsp;&nbsp;<br/>&lt;/div&gt;</div></div>&nbsp;<br/>　　如果要实现b在a中居中放置，一般只需用CSS设置a的text-align属性为center。这样的方法在IE里看起来一切正常；但是在Firefox中b却会是居左的。<br/>　　解决办法就是设置b的横向margin为auto。例如设置b的CSS样式为：margin:&nbsp;0&nbsp;auto;。<br/>　　更多的问题与CSS知识，您可以在52CSS.com上获得，多多加油，愿您前程似锦。<br/>&nbsp;&nbsp;　　]]></summary>
	  <link rel="alternate" type="text/html" href="http://www.52css.com/default.asp?id=1153" /> 
	  <id>http://www.52css.com/default.asp?id=1153</id> 
  </entry>	
		
  <entry>
	  <title type="html"><![CDATA[CSS Hack区分浏览器 IE6 IE7 IE8 Firefox Opera Safari]]></title>
	  <author>
		 <name>52css</name>
		 <uri>http://www.52css.com/</uri>
		 <email>MrJin@52css.com</email>
	  </author>
	  <category term="" scheme="http://www.52css.com/default.asp?cateID=3" label="Div+CSS教程" /> 
	  <updated>2010-01-21T21:50:18+08:00</updated>
	  <published>2010-01-21T21:50:18+08:00</published>
		  <summary type="html"><![CDATA[　　CSS&nbsp;Hack是在标准&nbsp;CSS&nbsp;没办法兼容各浏览器显示效果时才会用上的补救方法，我们在52css.com中不泛深入介绍CSS兼容性的文章。在各浏览器厂商解析&nbsp;CSS&nbsp;没有达成一致前，我们只能用这样的方法来完成这样的任务。<br/>　　在52css.com上你可能能搜索到一大堆的&nbsp;CSS&nbsp;Hack，但是我今天发布的你可能并不都很了解，因为这些都是只针对单独一个浏览器的&nbsp;CSS&nbsp;Hack。为了向你展示这些&nbsp;CSS&nbsp;Hack&nbsp;是否正常运作，我新建六个&nbsp;P&nbsp;标签，并给每一个&nbsp;P&nbsp;标签一个特有的&nbsp;id。这将向你展示&nbsp;CSS&nbsp;Hack&nbsp;的运作情况。<br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.52css.com/images/quote.gif" style="margin:0px 2px -3px 0px" alt="div css xhtml xml Example Source Code"/> Example Source Code <span style="font-weight:100;color:#f7f7f7;">[www.52css.com]</span></div><div class="UBBContent">&lt;p&nbsp;id=&#34;opera&#34;&gt;我来自&nbsp;Opera&nbsp;7.2&nbsp;-&nbsp;9.5&lt;/p&gt;&nbsp;<br/>&lt;p&nbsp;id=&#34;safari&#34;&gt;我是神奇的&nbsp;Safari&lt;/p&gt;&nbsp;<br/>&lt;p&nbsp;id=&#34;firefox&#34;&gt;我来自&nbsp;Firefox&lt;/p&gt;&nbsp;<br/>&lt;p&nbsp;id=&#34;firefox12&#34;&gt;我是你爷爷&nbsp;Firefox&nbsp;1&nbsp;-&nbsp;2&nbsp;&lt;/p&gt;<br/>&nbsp;&lt;p&nbsp;id=&#34;ie7&#34;&gt;我是囧&nbsp;IE&nbsp;7&lt;/p&gt;&nbsp;<br/>&lt;p&nbsp;id=&#34;ie6&#34;&gt;我是脑瘸&nbsp;IE&nbsp;6&lt;/p&gt;&nbsp;</div></div><br/>　　然后我让这些&nbsp;P&nbsp;标签默认都不显示<br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.52css.com/images/quote.gif" style="margin:0px 2px -3px 0px" alt="div css xhtml xml Example Source Code"/> Example Source Code <span style="font-weight:100;color:#f7f7f7;">[www.52css.com]</span></div><div class="UBBContent">&lt;style&nbsp;type=&#34;text/css&#34;&gt;&nbsp;body&nbsp;p{display:&nbsp;none;}&nbsp;&lt;/style&gt;&nbsp;</div></div><br/>　　使用&nbsp;IE&nbsp;CSS&nbsp;条件注释区分&nbsp;IE&nbsp;浏览器<br/>　　最简单的区分&nbsp;IE&nbsp;浏览器的方法自然是使用他们的条件注释。&nbsp;微软创建了一个强大的语法来让我们去实现这个功能。我不想再详细地介绍&nbsp;IE&nbsp;条件注释了，我想你在搜索引擎能搜索到上万个搜索条目，我这里只要这两个:<br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.52css.com/images/quote.gif" style="margin:0px 2px -3px 0px" alt="div css xhtml xml Example Source Code"/> Example Source Code <span style="font-weight:100;color:#f7f7f7;">[www.52css.com]</span></div><div class="UBBContent">&lt;!--[if&nbsp;IE&nbsp;7]&gt;&nbsp;<br/>&lt;style&nbsp;type=&#34;text/css&#34;&gt;&nbsp;<br/>&lt;/style&gt;&nbsp;&lt;![endif]--&gt;<br/>&nbsp;&lt;!--[if&nbsp;IE&nbsp;6]&gt;&nbsp;<br/>&lt;style&nbsp;type=&#34;text/css&#34;&gt;&nbsp;&lt;/style&gt;&nbsp;<br/>&lt;![endif]--&gt;&nbsp;</div></div><br/>　　使用&nbsp;CSS&nbsp;解析器&nbsp;Hacks&nbsp;区分&nbsp;IE<br/>　　虽说&nbsp;IE&nbsp;条件注释十分简单好用，但是如果你想把全部的&nbsp;CSS&nbsp;放到一个文件里的话，那么你不得不使用别的方法。注意这里的&nbsp;IE&nbsp;7&nbsp;Hack将只对&nbsp;IE7&nbsp;有效，因为&nbsp;IE6&nbsp;根本不知道&nbsp;&gt;&nbsp;选择符。同时你也得注意&nbsp;&gt;&nbsp;选择符对于其他浏览器同样是无效的。<br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.52css.com/images/quote.gif" style="margin:0px 2px -3px 0px" alt="div css xhtml xml Example Source Code"/> Example Source Code <span style="font-weight:100;color:#f7f7f7;">[www.52css.com]</span></div><div class="UBBContent">&nbsp;html&nbsp;&gt;&nbsp;body&nbsp;#ie7&nbsp;{*display:&nbsp;block;}&nbsp;<br/>&nbsp;body&nbsp;#ie6&nbsp;{_display:&nbsp;block;}</div></div>&nbsp;<br/>　　CSS&nbsp;Hack&nbsp;区分&nbsp;Firefox<br/>　　第一个使用了&nbsp;body:empty&nbsp;来区分&nbsp;Firefox&nbsp;1&nbsp;和&nbsp;2&nbsp;。第二个&nbsp;hack使用了全部&nbsp;Firefox&nbsp;浏览器的专有扩展&nbsp;-moz。&nbsp;-moz&nbsp;只对&nbsp;Firefox有效，使用这个&nbsp;Hack&nbsp;大可不必担心其他浏览器的影响。<br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.52css.com/images/quote.gif" style="margin:0px 2px -3px 0px" alt="div css xhtml xml Example Source Code"/> Example Source Code <span style="font-weight:100;color:#f7f7f7;">[www.52css.com]</span></div><div class="UBBContent">body:empty&nbsp;#firefox12&nbsp;{display:&nbsp;block;}<br/>@-moz-document&nbsp;url-prefix()&nbsp;{#firefox&nbsp;{&nbsp;display:&nbsp;block;&nbsp;}}&nbsp;&nbsp;</div></div><br/>　　CSS&nbsp;Hack&nbsp;区分&nbsp;Safari<br/>　　Safari&nbsp;的&nbsp;CSS&nbsp;hack&nbsp;与&nbsp;Firefox&nbsp;的&nbsp;hack&nbsp;看起来很像，使用的是&nbsp;Safari浏览器的专有扩展&nbsp;-webkit&nbsp;且只对&nbsp;Safari&nbsp;浏览器有效。<br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.52css.com/images/quote.gif" style="margin:0px 2px -3px 0px" alt="div css xhtml xml Example Source Code"/> Example Source Code <span style="font-weight:100;color:#f7f7f7;">[www.52css.com]</span></div><div class="UBBContent">@media&nbsp;screen&nbsp;and&nbsp;(-webkit-min-device-pixel-ratio:0)&nbsp;{#safari&nbsp;{&nbsp;display:&nbsp;block;&nbsp;}}&nbsp;</div></div><br/>　　CSS&nbsp;Hack&nbsp;区分&nbsp;Opera<br/>&nbsp;<br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.52css.com/images/quote.gif" style="margin:0px 2px -3px 0px" alt="div css xhtml xml Example Source Code"/> Example Source Code <span style="font-weight:100;color:#f7f7f7;">[www.52css.com]</span></div><div class="UBBContent">@media&nbsp;all&nbsp;and&nbsp;(-webkit-min-device-pixel-ratio:10000),&nbsp;not&nbsp;all&nbsp;and&nbsp;(-webkit-min-device-pixel-ratio:0)&nbsp;{head~body&nbsp;#opera&nbsp;{&nbsp;display:&nbsp;block;&nbsp;}}&nbsp;</div></div><br/>　　<strong>然后，全部合在一起便是</strong><br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.52css.com/images/quote.gif" style="margin:0px 2px -3px 0px" alt="div css xhtml xml Example Source Code"/> Example Source Code <span style="font-weight:100;color:#f7f7f7;">[www.52css.com]</span></div><div class="UBBContent">&lt;!DOCTYPE&nbsp;HTML&nbsp;PUBLIC&nbsp;&#34;-//W3C//DTD&nbsp;HTML&nbsp;4.01//EN&#34;&nbsp;&#34;<a href="http://www.w3.org/TR/html4/strict.dtd" target="_blank">http://www.w3.org/TR/html4/strict.dtd</a>&#34;&gt;<br/>&lt;html&nbsp;lang=&#34;en&#34;&gt;<br/>&lt;head&gt;<br/>&lt;meta&nbsp;http-equiv=&#34;Content-Type&#34;&nbsp;content=&#34;text/html;&nbsp;charset=utf-8&#34;&gt;<br/>&lt;title&gt;CSS&nbsp;Browser&nbsp;Hacks&nbsp;-&nbsp;52css.com&lt;/title&gt;<br/>&lt;style&nbsp;type=&#34;text/css&#34;&gt;<br/>body&nbsp;p&nbsp;{<br/>&nbsp;&nbsp;&nbsp;&nbsp;display:&nbsp;none;<br/>}<br/><br/><br/>html:first-child&nbsp;#opera&nbsp;{<br/>&nbsp;&nbsp;&nbsp;&nbsp;display:&nbsp;block;<br/>}<br/><br/>&nbsp;html&nbsp;&gt;&nbsp;body&nbsp;#ie7&nbsp;{<br/>*display:&nbsp;block;<br/>}<br/><br/>&nbsp;body&nbsp;#ie6&nbsp;{<br/>&nbsp;&nbsp;&nbsp;&nbsp;_display:&nbsp;block;<br/>}<br/><br/>body:empty&nbsp;#firefox12&nbsp;{<br/>&nbsp;&nbsp;&nbsp;&nbsp;display:&nbsp;block;<br/>}<br/>&nbsp;<br/>@-moz-document&nbsp;url-prefix()&nbsp;{<br/>&nbsp;#firefox&nbsp;{<br/>&nbsp;&nbsp;&nbsp;&nbsp;display:&nbsp;block;<br/>}<br/>}<br/><br/><br/>@media&nbsp;screen&nbsp;and&nbsp;(-webkit-min-device-pixel-ratio:0)&nbsp;{<br/>#safari&nbsp;{<br/>display:&nbsp;block;<br/>}<br/>}<br/><br/>@media&nbsp;all&nbsp;and&nbsp;(-webkit-min-device-pixel-ratio:10000),&nbsp;not&nbsp;all&nbsp;and&nbsp;(-webkit-min-device-pixel-ratio:0)&nbsp;{<br/>head~body&nbsp;#opera&nbsp;{<br/>display:&nbsp;block;<br/>}<br/>}<br/>&lt;/style&gt;<br/>&lt;/head&gt;<br/>&lt;body&gt;<br/>&lt;p&nbsp;id=&#34;opera&#34;&gt;我来自&nbsp;Opera&nbsp;7.2&nbsp;-&nbsp;9.5&lt;/p&gt;<br/>&lt;p&nbsp;id=&#34;safari&#34;&gt;我是神奇的&nbsp;Safari&lt;/p&gt;<br/>&lt;p&nbsp;id=&#34;firefox&#34;&gt;我来自&nbsp;Firefox&lt;/p&gt;<br/>&lt;p&nbsp;id=&#34;firefox12&#34;&gt;我是你爷爷&nbsp;Firefox&nbsp;1&nbsp;-&nbsp;2&nbsp;&lt;/p&gt;<br/>&lt;p&nbsp;id=&#34;ie7&#34;&gt;我是囧&nbsp;IE&nbsp;7&lt;/p&gt;<br/>&lt;p&nbsp;id=&#34;ie6&#34;&gt;我是脑瘸&nbsp;IE&nbsp;6&lt;/p&gt;<br/>&lt;/body&gt;<br/>&lt;/html&gt;</div></div>&nbsp;<br/>　　CSS&nbsp;Hack&nbsp;虽好且方便兼容各浏览器，但是通不过&nbsp;W3C&nbsp;验证，所以还得自己权衡是否有必要去使用。<br/>　　]]></summary>
	  <link rel="alternate" type="text/html" href="http://www.52css.com/default.asp?id=1152" /> 
	  <id>http://www.52css.com/default.asp?id=1152</id> 
  </entry>	
		
</feed>