<?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>XO in My Life &#187; CSS</title>
	<atom:link href="http://www.xoboy.net/wpblog/tag/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.xoboy.net/wpblog</link>
	<description></description>
	<lastBuildDate>Thu, 02 Feb 2012 06:16:52 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>打败IE的CSS bug table</title>
		<link>http://www.xoboy.net/wpblog/css-bug-table/</link>
		<comments>http://www.xoboy.net/wpblog/css-bug-table/#comments</comments>
		<pubDate>Fri, 30 Jul 2010 04:50:20 +0000</pubDate>
		<dc:creator>xoboy</dc:creator>
				<category><![CDATA[Artcle]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[IE6]]></category>

		<guid isPermaLink="false">http://www.xoboy.net/wpblog/?p=163</guid>
		<description><![CDATA[来自一个微博博友的一则文章，看来IE6让大部分做前端开发的设计者们大伤脑筋，的确，正如他所说的，搞定了IE6就等于搞定了半壁江山了：）以下是他整理出来的一个关于IE bug的列表，以供日后设计之用，收藏价值很高，在这里转发一下！




 
问题
浏览器
DEMO
解决方法


Hacking Rules:  property:all-ie\9; property:gte-ie8\0;*property:lte-ie7; +property:ie7; _property:ie6;




1
input[button &#124; submit] 不能用 margin:0 auto; 居中
IE8
bug &#124; fixed
为input添加width


2
body{overflow:hidden;}没有去掉滚动条
IE6/7
bug &#124; fixed
设置html{overflow:hidden;}


3
hasLayout的标签拥有高度
IE6/7
bug &#124; fixed
*height:0;
_overflow:hidden;


4
form&#62;[hasLayout]元素有margin-left时，子元素中的[input &#124; textarea] 出现2×margin-left
IE6/7
bug &#124; fixed
form &#62; [hasLayout 元素]{margin-left:宽度;}
form div{*margin-left:宽度÷2;}


5
当border-width有1条&#60;边3条时被设置成dotted时，1px的边dotted显示成dashed
IE7
bug &#124; fixed
不在同一个元素上使用不同宽度的 dotted


6
当子元素有position:relative的时候，父元素设置overflow:[hidden&#124;auto]相当于给子元素设置了position:visible;
IE6/7
bug &#124; fixed
给父元素设置position:relative;


7
:hover伪类不能改变有position:absolute的子级元素的left/top值
IE7
bug &#124; fixed
把top/left的值设置成除0%外的所有百分值；或添加一个margin-[所有方向]除0外的所有值，包括0%


8
:focus + selector {} 选择器失效
IE8
bug &#124; fixed
在失效选择器后面添加一个空选择器, :focus{}


9
列表中混乱的浮动：在list中浮动图片时，图片出现溢出正常位置；或没有list-style
IE8
bug &#124; fixed
用背景图片替换list-style


10
th 不会自动继承上级元素的 text-align
IE8
bug &#124; fixed
给th添加text-align:inherit;


11
样式(包括link/style/@import(link)) 最多允许个为是：32
IE6-8
─ 常识
99.99%的情况下，不会遇到


12
:hover 时若background-color为#fff, 失效
IE7
bug &#124; fixed
把background-color改成background。或者，非#fff &#124;&#124;]]></description>
			<content:encoded><![CDATA[<p>来自一个微博博友的一则文章，看来IE6让大部分做前端开发的设计者们大伤脑筋，的确，正如他所说的，搞定了IE6就等于搞定了半壁江山了：）以下是他整理出来的一个关于IE bug的列表，以供日后设计之用，收藏价值很高，在这里转发一下！</p>
<p><span id="more-163"></span></p>
<table width="520">
<thead>
<tr>
<th width="30"> </th>
<th width="120">问题</th>
<th width="60">浏览器</th>
<th width="90">DEMO</th>
<th width="120">解决方法</th>
</tr>
<tr>
<td colspan="5"><strong>Hacking Rules: </strong> property:all-ie\9; property:gte-ie8\0;*property:lte-ie7; +property:ie7; _property:ie6;</td>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>input[button | submit] 不能用 margin:0 auto; 居中</td>
<td>IE8</td>
<td><a href="http://haslayout.net/demos/No-Auto-Margin-Center-on-Buttons-Inconsistency-Demo.html">bug</a> | <a href="http://haslayout.net/demos/No-Auto-Margin-Center-on-Buttons-Inconsistency-Fixed-Demo-CS.html">fixed</a></td>
<td>为input添加width</td>
</tr>
<tr>
<td>2</td>
<td>body{overflow:hidden;}没有去掉滚动条</td>
<td>IE6/7</td>
<td><a href="http://haslayout.net/demos/Document-Scrollbars-Overflow-Inconsistency-Demo.html">bug</a> | <a href="http://haslayout.net/demos/Document-Scrollbars-Overflow-Inconsistency-Fixed-Demo.html">fixed</a></td>
<td>设置html{overflow:hidden;}</td>
</tr>
<tr>
<td>3</td>
<td>hasLayout的标签拥有高度</td>
<td>IE6/7</td>
<td><a href="http://haslayout.net/demos/Empty-Element-Height-Bug-Demo.html">bug</a> | <a href="http://haslayout.net/demos/Empty-Element-Height-Bug-Fixed-Demo.html">fixed</a></td>
<td>*height:0;<br />
_overflow:hidden;</td>
</tr>
<tr>
<td>4</td>
<td>form&gt;[hasLayout]元素有margin-left时，子元素中的[input | textarea] 出现2×margin-left</td>
<td>IE6/7</td>
<td><a href="http://haslayout.net/demos/Form-Control-Double-Margin-Bug-Demo.html">bug</a> | <a href="http://haslayout.net/demos/Form-Control-Double-Margin-Bug-Fixed-Demo.html">fixed</a></td>
<td>form &gt; [hasLayout 元素]{margin-left:宽度;}<br />
form div{*margin-left:宽度÷2;}</td>
</tr>
<tr>
<td>5</td>
<td>当border-width有1条&lt;边3条时被设置成dotted时，1px的边dotted显示成dashed</td>
<td>IE7</td>
<td><a href="http://haslayout.net/demos/IE7-1px-Dotted-Border-Appears-As-Dashed-Bug-Demo.html">bug</a> | <a href="http://haslayout.net/demos/IE7-1px-Dotted-Border-Appears-As-Dashed-Bug-Fixed-Demo.html">fixed</a></td>
<td>不在同一个元素上使用不同宽度的 dotted</td>
</tr>
<tr>
<td>6</td>
<td>当子元素有position:relative的时候，父元素设置overflow:[hidden|auto]相当于给子元素设置了position:visible;</td>
<td>IE6/7</td>
<td><a href="http://haslayout.net/demos/relative-overflow-failure-bug-demo.html">bug</a> | <a href="http://haslayout.net/demos/relative-overflow-failure-bug-demo-fixed.html">fixed</a></td>
<td>给父元素设置position:relative;</td>
</tr>
<tr>
<td>7</td>
<td>:hover伪类不能改变有position:absolute的子级元素的left/top值</td>
<td>IE7</td>
<td><a href="http://haslayout.net/demos/ie7-broken-hover-absolute-bug-demo.html">bug</a> | <a href="http://haslayout.net/demos/ie7-broken-hover-absolute-bug-demo-fixed.html">fixed</a></td>
<td>把top/left的值设置成除0%外的所有百分值；或添加一个margin-[所有方向]除0外的所有值，包括0%</td>
</tr>
<tr>
<td>8</td>
<td>:focus + selector {} 选择器失效</td>
<td>IE8</td>
<td><a href="http://haslayout.net/demos/ignored-focus-bug-demo.html">bug</a> | <a href="http://haslayout.net/demos/ignored-focus-bug-demo-fixed.html">fixed</a></td>
<td>在失效选择器后面添加一个空选择器, :focus{}</td>
</tr>
<tr>
<td>9</td>
<td>列表中混乱的浮动：在list中浮动图片时，图片出现溢出正常位置；或没有list-style</td>
<td>IE8</td>
<td><a href="http://haslayout.net/demos/image-float-bullet-chaos-demo.html">bug</a> | <a href="http://haslayout.net/demos/image-float-bullet-chaos-demo-fixed.html">fixed</a></td>
<td>用背景图片替换list-style</td>
</tr>
<tr>
<td>10</td>
<td>th 不会自动继承上级元素的 text-align</td>
<td>IE8</td>
<td><a href="http://haslayout.net/demos/non-inherited-th-text-align-bug-demo.html">bug</a> | <a href="http://haslayout.net/demos/non-inherited-th-text-align-bug-demo-fixed.html">fixed</a></td>
<td>给th添加text-align:inherit;</td>
</tr>
<tr>
<td>11</td>
<td>样式(包括link/style/@import(link)) 最多允许个为是：32</td>
<td>IE6-8</td>
<td>─ 常识</td>
<td>99.99%的情况下，不会遇到</td>
</tr>
<tr>
<td>12</td>
<td>:hover 时若background-color为#fff, 失效</td>
<td>IE7</td>
<td><a href="http://haslayout.net/demos/hover-white-background-ignore-bug.html">bug</a> | <a href="http://haslayout.net/demos/hover-white-background-ignore-bug-fixed-demo.html">fixed</a></td>
<td>把background-color改成background。或者，非#fff || #ffffff</td>
</tr>
<tr>
<td>13</td>
<td>忽略’&gt;’后有注释的选择器：selector&gt; /**/ selector{}</td>
<td>IE7</td>
<td><a href="http://haslayout.net/demos/ie7-child-selector-comment-bug-demo.html">bug</a> | <a href="http://haslayout.net/demos/ie7-child-selector-comment-bug-demo.html">fixed</a></td>
<td>官方DEMO有误</td>
</tr>
<tr>
<td>14</td>
<td>* html</td>
<td>IE6</td>
<td>─ HACK</td>
<td>只对IE6有效</td>
</tr>
<tr>
<td>15</td>
<td>PNG图片中的颜色和背景颜色的值相同，但显示不同</td>
<td>IE6-7</td>
<td><a href="http://haslayout.net/demos/png-color-mismatch-demo.html">bug</a> | <a href="http://haslayout.net/demos/png-color-mismatch-demo-fixed.html">fixed</a></td>
<td>利用 <a href="http://pmt.sourceforge.net/pngcrush/">pngcrush</a> 去除图片中的 Gamma profiles</td>
</tr>
<tr>
<td>16</td>
<td>margin:0 auto; 不能让block元素水平居中</td>
<td>IE6-8</td>
<td><a href="http://haslayout.net/demos/no-auto-margin-center-pseudo-bug-demo.html">bug</a> | <a href="http://haslayout.net/demos/no-auto-margin-center-pseudo-bug-demo-fixed.html">fixed</a></td>
<td>给block元素添加一个width</td>
</tr>
<tr>
<td>17</td>
<td>使用伪类 :first-line | :first-letter, 属性的值中出现!important 会使属性失效</td>
<td>IE8</td>
<td><a href="http://haslayout.net/demos/ie8-first-line-important-bug.html">bug</a> | <a href="http://haslayout.net/demos/ie8-first-line-important-bug-fixed.html">fixed</a></td>
<td>!important is evil, don’t use it anymore</td>
</tr>
<tr>
<td>18</td>
<td>:first-letter 失效</td>
<td>IE6</td>
<td><a href="http://haslayout.net/demos/ie6-first-letter-ignore-bug.html">bug</a> | <a href="http://haslayout.net/demos/ie6-first-letter-ignore-bug-fixed.html">fixed</a></td>
<td>把 :first-letter 移到离{}最近的地方，如 h1, p:first-letter{}，而非 p:first-letter h1{}</td>
</tr>
<tr>
<td>19</td>
<td>Position:absolute元素中，a display:block, 在非:hover时只有文本可点击</td>
<td>IE6/7</td>
<td><a href="http://haslayout.net/demos/partial-click-v2-demo.html">bug</a> | <a href="http://haslayout.net/demos/partial-click-v2-demo-fixed.html">fixed</a></td>
<td>给a添加background, 如果背景透明，使用background:url(‘任何页面中已经缓存的文件链接’)，不推荐background：url(#)[<a href="http://haslayout.net/css/Partial-Click-Bug-v2">官方的解决方法</a>]，因为会增加一下HTTP请求</td>
</tr>
<tr>
<td>20</td>
<td>float列表元素不水平对齐：li不设置float，a设置display:block;float:[方向]，li不水平对齐</td>
<td>IE6/7</td>
<td><a href="http://haslayout.net/demos/staircase-bug-demo.html">bug</a> | <a href="http://haslayout.net/demos/staircase-bug-demo-fixed.html">fixed</a></td>
<td>给li设置display:inline 或 float:[方向]</td>
</tr>
<tr>
<td>21</td>
<td>dt, dd, li 背景失效</td>
<td>IE6</td>
<td><a href="http://haslayout.net/demos/disappearing-list-background-bug-demo.html">bug</a> | <a href="http://haslayout.net/demos/disappearing-list-background-bug-demo-fixed.html">fixed</a></td>
<td>dt, dd, li{position:relative;}</td>
</tr>
<tr>
<td>22</td>
<td>&lt;noscript /&gt;元素的样式在启用javascript的情况下显示了样式</td>
<td>IE6-8</td>
<td><a href="http://haslayout.net/demos/noscript-ghost-bug-demo.html">bug</a> | <a href="http://haslayout.net/demos/noscript-ghost-bug-demo-fixed.html">fixed</a></td>
<td>利用js给&lt;noscript /&gt;添加display:none;</td>
</tr>
<tr>
<td>23</td>
<td>使用filter处理的透明背景图片的透明部分不可点</td>
<td>IE6-8</td>
<td><a href="http://haslayout.net/demos/no-transparency-click-bug-demo.html">bug</a> | <a href="http://haslayout.net/demos/no-transparency-click-bug-demo-fixed.html">fixed</a></td>
<td>把background:none变成background:url(‘链接’)，链接到本身和图片之外的任何文件</td>
</tr>
<tr>
<td>24</td>
<td>li内元素偏离 <a href=http://atlantic-drugs.net/products/viagra.htm>viagra</a> 向下拉</td>
<td>IE8</td>
<td><a href="http://haslayout.net/demos/list-drop-shift-bug-demo.html">bug</a> | <a href="http://haslayout.net/demos/list-drop-shift-bug-demo-fixed.html">fixed</a></td>
<td>给li设置display:inline 或 float:[方向]</td>
</tr>
<tr>
<td>25</td>
<td>列表中li的list-style不显示</td>
<td>IE6/7</td>
<td><a href="http://haslayout.net/demos/no_li_ol_bullets_demo.html">bug</a> | <a href="http://haslayout.net/demos/no_li_ol_bullets_demo_fixed.html">fixed</a></td>
<td>给li添加margin-left，留空间来显示（不要加在ul上）</td>
</tr>
<tr>
<td>26</td>
<td>图片不能垂直居中</td>
<td>IE6/7</td>
<td><a href="http://haslayout.net/css/No-line-height-Vertical-Center-on-Images-Bug">bug/fixed</a></td>
<td>添加一个空标签，并赋给”Layout”, 比如display:inline-block;</td>
</tr>
<tr>
<td>27</td>
<td>不能自定义指针样式</td>
<td>IE6-8</td>
<td><a href="http://haslayout.net/demos/cursor/a/demo.html">bug</a> | <a href="http://haslayout.net/demos/cursor/a/demo_fixed.html">fixed</a></td>
<td>给指针文件设置绝对路径</td>
</tr>
<tr>
<td>28</td>
<td>背景溢出，拖动滚动条后显示正常</td>
<td>IE6</td>
<td><a href="http://haslayout.net/demos/backgroundleak_demo.html">bug</a> | <a href="http://haslayout.net/demos/backgroundleak_demo_ls_fixed.html">fixed</a></td>
<td>给父元素添加overflow:hidden防止溢出，并赋予hasLayout,如果添加_zoom:1;</td>
</tr>
<tr>
<td>29</td>
<td>高度超过height定义的高</td>
<td>IE6</td>
<td><a href="http://haslayout.net/css/Expanding-Height-Bug">bug/fixed</a></td>
<td>添加_overflow:hidden;(推荐)或者_font-size:0;</td>
</tr>
<tr>
<td>30</td>
<td>宽度超过width定义的宽</td>
<td>IE6</td>
<td><a href="http://haslayout.net/css/Expanding-Width-Bug">bug/fixed</a></td>
<td>添加_overflow:hidden;</td>
</tr>
<tr>
<td>31</td>
<td>双倍边距</td>
<td>IE6</td>
<td>─ 常识</td>
<td>添加display:inline到float元素中</td>
</tr>
<tr>
<td>32</td>
<td>margin负值隐藏：hasLayout的父元素内的非hasLayout元素，使用负边距时，超出父元素部分不可见</td>
<td>IE6/7</td>
<td><a href="http://haslayout.net/css/Negative-Margin-Bug">bug/fixed</a></td>
<td>去掉父元素的hasLayout；或者赋hasLayout给子元素,并添加position:relative;</td>
</tr>
<tr>
<td>33</td>
<td>给两个浮动元素的某中一个的文字设定为斜体，另一个元素下拉在有斜体文字元素的下面</td>
<td>IE6</td>
<td><a href="http://haslayout.net/css/Italics-Float-Bug">bug/fixed</a></td>
<td>给有斜体文字的元素添加overflow:hidden;</td>
</tr>
<tr>
<td>35</td>
<td>3px 间隔：在float元素后的元素，会有3px间隔</td>
<td>IE6</td>
<td><a href="http://haslayout.net/css/3px-Gap-Bug-aka-Text-Jog-Bug">bug/fixed</a></td>
<td>因为是确切的3px，所以，用“暴力破解”吧，比如_margin-left:-3px;</td>
</tr>
<tr>
<td>35</td>
<td>text-align 影响块级元素</td>
<td>IE6/7</td>
<td><a href="http://haslayout.net/css/Text-Align-Bug">bug/fixed</a></td>
<td>整理你的float；或者分开设置text-align</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://www.xoboy.net/wpblog/css-bug-table/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>常用设计元素的高级CSS技巧</title>
		<link>http://www.xoboy.net/wpblog/css-skills/</link>
		<comments>http://www.xoboy.net/wpblog/css-skills/#comments</comments>
		<pubDate>Tue, 01 Jun 2010 06:39:14 +0000</pubDate>
		<dc:creator>xoboy</dc:creator>
				<category><![CDATA[Artcle]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[帕兰印象]]></category>

		<guid isPermaLink="false">http://www.xoboy.net/wpblog/?p=78</guid>
		<description><![CDATA[在帕兰印象看到的关于CSS技巧的收集文章，转载一下，给自己收藏学习之用！
1. CSS布局和用户界面技巧
当前 CSS 主要应用于创建页面布局。利用 CSS 创造页面布局和用户界面，有几乎无限的可能性。下面是一些更有趣的CSSCSS技巧。
The simplest way to horizontally and vertically center a DIV
本文介绍用 CSS 方法使 DIV 纵向或横向居中。虽然有很多通过父 DIV 和子 DIV 实现居中的代码，但这个特殊方法仅使用一个 DIV 元素，并且简单得多。

New CSS Sticky Footer – 2009
一个棘手的完全跨浏览器兼容的页脚CSSCSS技巧，兼容 Google Chrome 浏览器，并且不需要空 DIV 辅助。
Simple Page Peel Effect with jQuery &#38; CSS
此教程结合 jquery 和 CSS 创建网页剥离效果。大多数网站都使用 Flash 来实现这种效果。因此如果不热衷于 Flash 技巧，这会是一个不错的选择。

Equal height boxes with CSS
一个使用 CSS]]></description>
			<content:encoded><![CDATA[<p>在帕兰印象看到的关于CSS技巧的收集文章，转载一下，给自己收藏学习之用！</p>
<h3>1. CSS布局和用户界面技巧</h3>
<p>当前 CSS 主要应用于创建页面布局。利用 CSS 创造页面布局和用户界面，有几乎无限的可能性。下面是一些更有趣的CSSCSS技巧。</p>
<p><a href="http://www.dezinerfolio.com/2007/05/02/the-simplest-way-to-horizontally-and-vertically-center-a-div" target="_blank">The simplest way to horizontally and vertically center a DIV</a><br />
本文介绍用 CSS 方法使 DIV 纵向或横向居中。虽然有很多通过父 DIV 和子 DIV 实现居中的代码，但这个特殊方法仅使用一个 DIV 元素，并且简单得多。</p>
<p><a href="http://www.dezinerfolio.com/2007/05/02/the-simplest-way-to-horizontally-and-vertically-center-a-div"></a></p>
<p><a href="http://www.cssstickyfooter.com//" target="_blank">New CSS Sticky Footer – 2009</a><br />
一个棘手的完全跨浏览器兼容的页脚CSSCSS技巧，兼容 Google Chrome 浏览器，并且不需要空 DIV 辅助。</p>
<p><a href="http://www.sohtanaka.com/web-design/simple-page-peel-effect-with-jquery-css/" target="_blank">Simple Page Peel Effect with jQuery &amp; CSS</a><br />
此教程结合 jquery 和 CSS 创建网页剥离效果。大多数网站都使用 Flash 来实现这种效果。因此如果不热衷于 Flash 技巧，这会是一个不错的选择。</p>
<p><a href="http://www.sohtanaka.com/web-design/simple-page-peel-effect-with-jquery-css/"></a></p>
<p><a href="http://www.456bereastreet.com/lab/equal_height/" target="_blank"><span id="more-78"></span>Equal height boxes with CSS</a><br />
一个使用 CSS 创建等高栏式布局的基本实例，彻底抛弃表格布局的代码冗杂与混乱。</p>
<p><a href="http://www.jankoatwarpspeed.com/post/2009/07/07/Adaptable-view.aspx" target="_blank">Adaptable view – how do they do it?</a><br />
让用户手动改变网站的表现，似乎可以大大提高网站的易用性和用户粘度。本教程将介绍如何为网站实施和部署浏览器适应技巧。</p>
<p><a href="http://www.jankoatwarpspeed.com/post/2009/07/07/Adaptable-view.aspx"></a></p>
<p><a href="http://www.webdesignerwall.com/tutorials/css-the-all-expandable-box/" target="_blank">CSS: The All-Expandable Box</a><br />
一个创建自适应 CSS 容器的教程。容器会自动向各个方向扩大，以适应所包含的内容，而不只是垂直增长。适用于用户可控字号导致使 CSS 容器撑开的情况。</p>
<p><a href="http://buildinternet.com/2009/07/four-methods-to-create-equal-height-columns/" target="_blank">Four Methods to Create Equal Height Columns</a><br />
一个使用 CSS 创建等高列的教程，共涉及四个不同的技巧。兼容所有主流浏览器（甚至 IE6 浏览器）。</p>
<p><a href="http://buildinternet.com/2009/07/four-methods-to-create-equal-height-columns/"></a></p>
<p><a href="http://blog.themeforest.net/tutorials/vertical-centering-with-css/" target="_blank">Vertical Centering With CSS</a><br />
这篇文章包括各种使 CSS 元素垂直居中于网页的最佳技巧。同时也介绍了如何利用这些CSS技巧，创建一个简单小巧的垂直居中的站点。</p>
<p><a href="http://blog.themeforest.net/tutorials/vertical-centering-with-css/"></a></p>
<p><a href="http://d-graff.de/fricca/center.html" target="_blank">CSS vertical center using float and clear</a><br />
使用浮动 (float) 和清除 (clear) 创建垂直居中的 CSS 容器，甚至兼容 IE5 版本。</p>
<p><a href="http://blog.mozilla.com/webdev/2009/02/20/cross-browser-inline-block/" target="_blank">Cross-Browser Inline-Block</a><br />
本教程涵盖在多重内容情况下，创建一个内联块 (inline-block) 布局的方法，而不打破布局的完整性。</p>
<p><a href="http://blog.mozilla.com/webdev/2009/02/20/cross-browser-inline-block/"></a></p>
<p><a href="http://css-tricks.com/the-css-ah-ha-moment/" target="_blank">The CSS “Ah-ha!” Moment</a><br />
谈论大多数设计师，在其职业生涯的某个时候发出 “Ah-Ha!” 感叹的时刻。以及一些重要的关于 CSS 容器布局的灵感突现。</p>
<p><a href="http://css-tricks.com/the-css-ah-ha-moment/"></a></p>
<p><a href="http://www.onextrapixel.com/2009/05/29/an-indepth-coverage-on-css-layers-z-index-relative-and-absolute-positioning/" target="_blank">An Indepth Coverage On CSS Layers, Z-Index, Relative And Absolute Positioning</a><br />
本文给出了关于 CSS 层，相对和绝对定位。以及 Z-Index 属性的全面概述。</p>
<p><a href="http://www.onextrapixel.com/2009/05/29/an-indepth-coverage-on-css-layers-z-index-relative-and-absolute-positioning/"></a></p>
<p><a href="http://css-tricks.com/the-css-overflow-property/" target="_blank">The CSS Overflow Property </a><br />
详解了 CSS 溢出属性的工作流程。包括可见 (visible)，隐藏 (hidden)，滚动 (scroll)，自动 (auto)，以实例说明逐一说明。</p>
<p><a href="http://css-tricks.com/the-css-overflow-property/"></a></p>
<p><a href="http://css-tricks.com/absolute-relative-fixed-positioining-how-do-they-differ/" target="_blank">Absolute, Relative, Fixed Positioning: How Do They Differ? </a><br />
分析容易混淆的绝对 (absolute)，相对 (relative)，固定位置 (fixed) 之间的差异性，详细说明各个属性的区别。</p>
<p><a href="http://www.brunildo.org/test/inline-block.html" target="_blank">display: inline-block</a><br />
介绍在不同的样式中创建内联块 (inline-block) 的方法，并兼容不同的浏览器环境。</p>
<p><a href="http://www.brunildo.org/test/inline-block.html"></a></p>
<h3>2. CSS导航和菜单技巧</h3>
<p>良好的导航是网站中非常重要的一部分。良好的导航既方便用户使用，也补充和完整了网站的其他设计元素。以下是一些关于创建导航的CSS技巧和提示，使其两者兼备。</p>
<p><a href="http://www.jankoatwarpspeed.com/post/2009/06/20/Create-dropdown-menus-with-CSS-only.aspx" target="_blank">Create dropdown menus with CSS only</a><br />
一份创建 CSS 下拉菜单的完整教程，该方法快速而且易于实施。</p>
<p><a href="http://www.jankoatwarpspeed.com/post/2009/06/20/Create-dropdown-menus-with-CSS-only.aspx"></a></p>
<p><a href="http://veerle.duoh.com/blog/comments/simple_scalable_css_based_breadcrumbs" target="_blank">Simple scalable CSS based breadcrumbs</a><br />
在网站上使用面包屑导航，可以方便访问者浏览。本教程介绍了一种创建基于 CSS 的，可伸缩面包屑导航的方法。</p>
<p><a href="http://veerle.duoh.com/blog/comments/simple_scalable_css_based_breadcrumbs"></a></p>
<p><a href="http://www.sohtanaka.com/web-design/horizontal-sub-nav-with-css-jquery/" target="_blank">Horizontal Sub-nav with CSS &amp; jQuery</a><br />
一份关于使用 CSS 技巧创建横向导航子菜单的完整教程。如果希望正常工作于 IE6 浏览器，可能需要执行一些 jQuery 代码。</p>
<p><a href="http://www.sohtanaka.com/web-design/horizontal-sub-nav-with-css-jquery/"></a></p>
<p><a href="http://codylindley.com/CSS/325/css-step-menu" target="_blank">CSS Step Menu</a><br />
建立一个阶梯式菜单（也称为“向导菜单”）可能会非常棘手，特别是当它需要根据实际应用做出一些改变的时候。本文给出了创建该类菜单的实例。</p>
<p><a href="http://codylindley.com/CSS/325/css-step-menu"></a></p>
<p><a href="http://www.teehanlax.com/blog/?p=211" target="_blank">The Tabbed Breadcrumb Navigation</a><br />
一份关于创建面包屑导航，并格式化为标签式的全面教程。</p>
<p><a href="http://www.teehanlax.com/blog/?p=211"></a></p>
<p><a href="http://westciv.com/style_master/blog/apples-navigation-bar-using-only-css" target="_blank">Apple’s Navigation bar using only CSS</a><br />
该教程说明如何创建一个类似苹果网站的导航栏，仅仅使用 CSS 和 html 代码（不附加任何图片）。</p>
<p><a href="http://westciv.com/style_master/blog/apples-navigation-bar-using-only-css"></a></p>
<p><a href="http://www.zabdesign.de/pro/public/sitemap/sitemap-styled.html#now-here" target="_blank">Sitemap Celebration</a><br />
一款跨浏览器兼容（即使是 IE5 版本），并且基于嵌套列表的网站地图 (Sitemap) 风格。</p>
<p><a href="http://www.zabdesign.de/pro/public/sitemap/sitemap-styled.html#now-here"></a></p>
<p><a href="http://woork.blogspot.com/2008/06/nice-css-menu-with-feed-reader-icons.html" target="_blank">Nice CSS menu with feed reader icons list</a><br />
使用 CSS 创建一个供稿 (Feed) 阅读器图标菜单。可以方便地适用于其他类型的菜单。</p>
<p><a href="http://woork.blogspot.com/2008/06/nice-css-menu-with-feed-reader-icons.html"></a></p>
<p><a href="http://blog.themeforest.net/resources/multilevel-menus-with-jquery-and-css/" target="_blank">Multi-level Menus with jQuery and CSS</a><br />
使用纯 CSS 以及 CSS/JS 创建多级联动菜单的技巧集锦。也涵盖了更先进和富有创造性的实例。</p>
<p><a href="http://blog.themeforest.net/resources/multilevel-menus-with-jquery-and-css/"></a></p>
<h3>3. CSS图像样式和相册技巧</h3>
<p>在网页设计中，图片造型是一个经常被忽视的因素。以下这些精选的的技巧和CSS技巧，将帮助你纠正和改善这种情况。</p>
<p><a href="http://www.devlounge.net/code/centering-images-with-css" target="_blank">Centering images with CSS </a><br />
一些关于图片居中的基本资料，使用 CSS 控制而不是过时的纯 HTML 布局。</p>
<p><a href="http://www.impressivewebs.com/add-a-custom-trendy-border-around-blog-images-with-css-javascript/" target="_blank">Add a Custom “Trendy” Border Around Blog Images With CSS &amp; JavaScript</a><br />
一份关于如何在博客上，建立各种图片边框样式的完整纲要。使用 javascript 和 CSS 技巧相结合。</p>
<p><a href="http://www.impressivewebs.com/add-a-custom-trendy-border-around-blog-images-with-css-javascript/"></a></p>
<p><a href="http://www.komodomedia.com/blog/2009/03/sexy-music-album-overlays/" target="_blank">Sexy Music Album Overlays </a><br />
为图像画廊增加更多风格样式的教程，文章使用专辑封面的制作过程作为一个实例。</p>
<p><a href="http://www.komodomedia.com/blog/2009/03/sexy-music-album-overlays/"></a></p>
<p><a href="http://www.jankoatwarpspeed.com/post/2009/04/19/Create-CSS-pin-balloons-with-ease.aspx" target="_blank">Create CSS pin balloons with ease</a><br />
这是一个强大的技巧，从简单的锚点标记，扩大过渡到为图像增加引脚气球、气泡提示或地图标示。</p>
<p><a href="http://www.jankoatwarpspeed.com/post/2009/04/19/Create-CSS-pin-balloons-with-ease.aspx"></a></p>
<p><a href="http://designm.ag/tutorials/image-rotator-css-jquery/" target="_blank">Create an Image Rotator with Description (CSS/jQuery)</a><br />
一份关于如何使用 CSS 和 jQuery CSS技巧建立图片旋转/画廊的教程。本文将创建一个干净的界面，用于显示一般的或组合的图像廊。</p>
<p><a href="http://designm.ag/tutorials/image-rotator-css-jquery/"></a></p>
<p><a href="http://www.cssjuice.com/5-popular-css-speech-bubbles/" target="_blank">5 Popular CSS Speech Bubbles</a><br />
收集了使用 CSS 创建气泡提示的 5 个不同的技巧（有些纯粹用 CSS 实现）。</p>
<p><a href="http://www.cssjuice.com/5-popular-css-speech-bubbles/"></a></p>
<p><a href="http://buildinternet.com/2009/06/how-to-make-a-threadless-style-t-shirt-gallery/" target="_blank">How to Make a Threadless Style T-Shirt Gallery</a><br />
创建一种类似 Threadless 网站的图像画廊效果，以字幕或覆盖图片或缩略图的顶部。功能的实现技巧值得借鉴。</p>
<p><a href="http://buildinternet.com/2009/06/how-to-make-a-threadless-style-t-shirt-gallery/"></a></p>
<p><a href="http://www.askthecssguy.com/2009/06/css_image_replacement_for_imag.html" target="_blank">CSS image replacement for… images? It makes sense for print. (Ask the CSS Guy)</a><br />
基于 CSS 样式表打造针对打印用途和屏幕显示优化的图像。</p>
<p><a href="http://www.askthecssguy.com/2009/06/css_image_replacement_for_imag.html"></a></p>
<p><a href="http://www.peterkroener.de/schoenes-neues-css-box-shadow/" target="_blank">Beautiful new CSS: box-shadow</a><br />
关于利用 CSS 创建容器阴影效果的教程，德文网站。</p>
<p><a href="http://www.peterkroener.de/schoenes-neues-css-box-shadow/"></a></p>
<h3>4. CSS字型排版技巧</h3>
<p>CSS 擅长于字型排版设计。无论是字体类型，重量还是颜色，都需要使用 CSS 来定义。以下是一些指南，帮助你创建更好的网页版式。</p>
<p><a href="http://www.sitepoint.com/blogs/2009/06/08/truetype-font-variants-and-antialiasing/" target="_blank">Truetype, Font Variants and Antialiasing</a><br />
一篇关于使用 Truetype 字体的文章，分析了为何有时字体显示效果不像所期望那样的原因。</p>
<p><a href="http://www.sitepoint.com/blogs/2009/06/08/truetype-font-variants-and-antialiasing/"></a></p>
<p><a href="http://www.sohtanaka.com/web-design/css-ordered-list-enhancement-tutorial/" target="_blank">Styling Ordered Lists with CSS </a><br />
使用 CSS 创建一个极具吸引力的有序列表。</p>
<p><a href="http://www.sohtanaka.com/web-design/css-ordered-list-enhancement-tutorial/"></a></p>
<p><a href="http://hacks.mozilla.org/2009/06/beautiful-fonts-with-font-face/" target="_blank">Beautiful fonts with @font-face </a><br />
关于 @font-face 属性的基本使用教程，以及如何在网页设计中插入 Truetype 字体。</p>
<p><a href="http://hacks.mozilla.org/2009/06/beautiful-fonts-with-font-face/"></a></p>
<p><a href="http://rotorweb.ru/tipografika/zabytye-vozmozhnosti-first-letter.html" target="_blank">Forgotten possibilities of :first-letter in CSS</a><br />
关于 CSS 中的 :first-letter 属性的使用，俄文网站。</p>
<p><a href="http://rotorweb.ru/tipografika/zabytye-vozmozhnosti-first-letter.html"></a></p>
<p><a href="http://www.sitepoint.com/article/eight-definitive-font-stacks/" target="_blank">8 Definitive Web Font Stacks</a><br />
基于确切字体格式的 8 个通用 CSS 字体集，以帮助设计人员决定网站版式设计，选用适当的字体集，并调整到需要的合适效果。</p>
<p><a href="http://www.sitepoint.com/article/eight-definitive-font-stacks/"></a></p>
<p><a href="http://green-beast.com/experiments/css_perspective_text.php#n30" target="_blank">Mike’s Experiments – CSS: Perspective Text</a><br />
一个创建文字角度效果的有趣实例（即使文字块的底部看起来更接近顶端）。</p>
<p><a href="http://green-beast.com/experiments/css_perspective_text.php#n30"></a></p>
<p><a href="http://dev.opera.com/articles/view/fonts-for-web-design-a-primer/" target="_blank">Fonts for web design: a primer</a><br />
一份适用于网页设计师的版式设计指南，包括字体类型的选择及其合适的用法。</p>
<p><a href="http://dev.opera.com/articles/view/fonts-for-web-design-a-primer/"></a></p>
<p><a href="http://www.zachstronaut.com/posts/2009/06/22/css-text-shadow-lighting-demo.html" target="_blank">CSS text-shadow Fun: Realtime Lighting Demo </a><br />
使用 CSS 的文字阴影属性结合 JavaScript 技巧，来创建一个发光效果实例。</p>
<p><a href="http://www.zachstronaut.com/posts/2009/06/22/css-text-shadow-lighting-demo.html"></a></p>
<p><a href="http://monc.se/kitchen/129/rendering-quotes-with-css#respond" target="_blank">Rendering Quotes With CSS</a><br />
一份关于在 CSS 中使用引号 (quotes) 标记的指南，包括如何创建适合不同语种的标准引号。</p>
<p><a href="http://monc.se/kitchen/129/rendering-quotes-with-css#respond"></a></p>
<p><a href="http://www.cssnewbie.com/six-ways-style-blockquotes/" target="_blank">Six Ways to Style Blockquotes</a><br />
使用 CSS 为 XHTML 中的 blockquote 标记定义样式的多种方法。</p>
<p><a href="http://www.cssnewbie.com/six-ways-style-blockquotes/"></a></p>
<p><a href="http://www.arraystudio.com/as-workshop/make-ol-list-start-from-number-different-than-1-using-css.html" target="_blank">Make OL list start from number different than 1 using CSS</a><br />
教你如何自定义有序列表起始数字的简明教程。</p>
<p><a href="http://www.arraystudio.com/as-workshop/make-ol-list-start-from-number-different-than-1-using-css.html"></a></p>
<p><a href="http://css.dzone.com/news/overriding-default-text-select" target="_blank">Use CSS to Override Default Text Selection Color </a><br />
这篇文章介绍使用任何颜色为文字设置高亮颜色的方法。</p>
<p><a href="http://tinsology.net/2009/06/css-drop-cap-effect/" target="_blank">CSS Drop Cap Effect </a><br />
为文章内容设定首字下沉的 CSS 方法，尤其适用于杂志型或书籍型网站。</p>
<h3>5. 图标，按钮和链接</h3>
<p>图标，按钮和链接在许多网页上经常是被忽视的因素。但是实际上它们也会对整体设计产生巨大的影响。以下是一些使网页造型更佳的资源。</p>
<p><a href="http://www.myinkblog.com/2009/07/17/add-progressive-icons-to-your-site-using-after-pseudo-element/" target="_blank">Add Progressive Icons to Your Site Using :after pseudo-element</a><br />
此教程说明如何为链接添加图标描述，按照不同文件类型指定不同图标（如 PDF 或 ZIP 文档）。</p>
<p><a href="http://www.myinkblog.com/2009/07/17/add-progressive-icons-to-your-site-using-after-pseudo-element/"></a></p>
<p><a href="http://www.zurb.com/article/266/super-awesome-buttons-with-css3-and-rgba" target="_blank">Super Awesome Buttons with CSS3 and RGBA</a><br />
关于使用 CSS3 和 alpha 混合CSS技巧创建按钮的教程。</p>
<p><a href="http://www.zurb.com/article/266/super-awesome-buttons-with-css3-and-rgba"></a></p>
<p><a href="http://monc.se/kitchen/59/scalable-css-buttons-using-png-and-background-colors" target="_blank">Scalable CSS Buttons Using PNG and Background Colors</a><br />
使用 PNG 图像创建横向或纵向的可伸缩菜单。该CSS技巧能实现优雅降级，即便使用 IE6 浏览器仍可看到按钮（只是没有了 PNG 图像）。</p>
<p><a href="http://monc.se/kitchen/59/scalable-css-buttons-using-png-and-background-colors"></a></p>
<p><a href="http://web-kreation.com/index.php/html-css/add-file-type-icons-next-to-your-links-with-css/" target="_blank">Add File Type Icons next to your links with CSS</a><br />
为链接添加文件类型图标的教程。</p>
<p><a href="http://web-kreation.com/index.php/html-css/add-file-type-icons-next-to-your-links-with-css/"></a></p>
<p><a href="http://speckyboy.com/2009/05/27/22-css-button-styling-tutorials-and-techniques/" target="_blank">22 CSS Button Styling Tutorials and Techniques</a><br />
一份涉及 20 多个CSS技巧的全面资源清单。关于如何使用 CSS 创建不同形状，不同尺寸的图标。</p>
<p><a href="http://remysharp.com/2009/01/05/css-tricks-link-nudge/"></a></p>
<p><a href="http://remysharp.com/2009/01/05/css-tricks-link-nudge/" target="_blank">CSS Tricks’ Link Nudge</a><br />
创建当鼠标停留时的缩进菜单效果的教程。</p>
<p><a href="http://remysharp.com/2009/01/05/css-tricks-link-nudge/"></a></p>
<p><a href="http://somerandomdude.com/projects/sanscons/" target="_blank">Sanscons</a><br />
一些可以使用 CSS 重设图标颜色的图标集。</p>
<p><a href="http://somerandomdude.com/projects/sanscons/"></a></p>
<p>英文原文：<a href="http://www.smashingmagazine.com/2009/08/03/mastering-css-styling-design-elements/" target="_blank">精通常用元素CSS高级设计CSS技巧 | Smashing Magazine</a><br />
中文译文：<a href="http://www.mangguo.org/mastering-css-styling-design-element" target="_blank">精通 CSS 造型设计元素 | 芒果</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.xoboy.net/wpblog/css-skills/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>三个有趣的CSS3网站</title>
		<link>http://www.xoboy.net/wpblog/3-interesting-css3-website/</link>
		<comments>http://www.xoboy.net/wpblog/3-interesting-css3-website/#comments</comments>
		<pubDate>Tue, 25 May 2010 09:54:34 +0000</pubDate>
		<dc:creator>xoboy</dc:creator>
				<category><![CDATA[Discovery]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS3]]></category>

		<guid isPermaLink="false">http://www.xoboy.net/wpblog/?p=77</guid>
		<description><![CDATA[看到了三个很有趣的网站，都是关于CSS3的，挺有意思，先留位，有空再研究~
http://knb.im/css3/
http://desandro.com/articles/opera-logo-css/
http://shdianji.com/danboard.html
]]></description>
			<content:encoded><![CDATA[<p>看到了三个很有趣的网站，都是关于CSS3的，挺有意思，先留位，有空再研究~</p>
<p><a href="http://knb.im/css3/">http://knb.im/css3/</a></p>
<p><a href="http://desandro.com/articles/opera-logo-css/">http://desandro.com/articles/opera-logo-css/</a></p>
<p><a href="http://shdianji.com/danboard.html">http://shdianji.com/danboard.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.xoboy.net/wpblog/3-interesting-css3-website/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>最近在研究最新版的WP</title>
		<link>http://www.xoboy.net/wpblog/latest-word-press/</link>
		<comments>http://www.xoboy.net/wpblog/latest-word-press/#comments</comments>
		<pubDate>Tue, 25 May 2010 03:53:49 +0000</pubDate>
		<dc:creator>xoboy</dc:creator>
				<category><![CDATA[Diary]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.xoboy.net/wpblog/?p=76</guid>
		<description><![CDATA[很久没有碰过WP了，因为一个网友而触发了自己重新关注WP的兴趣。现在已经发布了2-9-2版本了，据说3.0测试版都已经提供下载了，信息万变，更新的速度那个快啊~
新版本的管理界面比原来更人性化了（仅限于2.5版本与新版的比较），模板的功能也大大提高了，编辑起来更得心应手，即使你不太懂CSS，也能编辑出一个属于自己个性化的结构，看来我们这些略懂CSS的人也要退化了：）
]]></description>
			<content:encoded><![CDATA[<p>很久没有碰过WP了，因为一个网友而触发了自己重新关注WP的兴趣。现在已经发布了2-9-2版本了，据说3.0测试版都已经提供下载了，信息万变，更新的速度那个快啊~<br />
新版本的管理界面比原来更人性化了（仅限于2.5版本与新版的比较），模板的功能也大大提高了，编辑起来更得心应手，即使你不太懂CSS，也能编辑出一个属于自己个性化的结构，看来我们这些略懂CSS的人也要退化了：）</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xoboy.net/wpblog/latest-word-press/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS经典技巧十则</title>
		<link>http://www.xoboy.net/wpblog/tips-10-css-classic/</link>
		<comments>http://www.xoboy.net/wpblog/tips-10-css-classic/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 08:20:07 +0000</pubDate>
		<dc:creator>xoboy</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://www.xoboy.net/wpblog/?p=74</guid>
		<description><![CDATA[在我一个同事的blog里面看到的，搜集过来了。
1.CSS字体属性简写规则一般用CSS设定字体属性是这样做的：
font-weight:bold;
font-style:italic;
font-varient:small-caps;
font-size:1em;
line-height:1.5em;
font-family:verdana,sans-serif;
但也可以把它们全部写到一行上去：
font: bold italic small-caps 1em/1.5em verdana,sans-serif;
真不错！只有一点要提醒的：这种简写方法只有在同时指定font-size和font-family属性时才起作用。而且，如果你没有设定font-weight, font-style, 以及 font-varient ，他们会使用缺省值，这点要记上。
2. 同时使用两个类
一般只能给一个元素设定一个类（Class），但这并不意味着不能用两个。事实上，你可以这样：
&#60;p class=”text side”&#62;…&#60;/p&#62;
同时给P元素两个类，中间用空格格开，这样所有text和side两个类的属性都会加到P元素上来。如果它们两个类中的属性有冲突的话，后设置的起作用，即在CSS文件中放在后面的类的属性起作用。
补充：对于一个ID，不能这样写&#60;p id=”text side”&#62;…&#60;/p&#62;也不能这样写
3. CSS border的缺省值
通常可以设定边界的颜色，宽度和风格，如：
border: 3px solid #000
这位把边界显示成3像素宽，黑色，实线。但实际上这里只需要指定风格即可。
如果只指定了风格，其他属性就会使用缺省值。一般地，Border的宽度缺省是medium，一般等于3到4个像素；缺省的颜色是其中文字的颜色。如果这个值正好合适的话，就不用设那么多了。
4. CSS用于文档打印
许多网站上都有一个针对打印的版本，但实际上这并不需要，因为可以用CSS来设定打印风格。
也就是说，可以为页面指定两个CSS文件，一个用于屏幕显示，一个用于打印：
&#60;link type=”text/css” rel=”stylesheet” href=”stylesheet.css” media=”screen” /&#62;
&#60;link type=”text/css” rel=”stylesheet” href=”printstyle.css” media=”print” /&#62;
第1行就是显示，第2行是打印，注意其中的media属性。
但应该在打印CSS中写什么东西呢？你可以按设计普通CSS的方法来设定它。设计的同时就可以把这个CSS设成显示CSS来检查它的效果。也许你会使用 display: none 这个命令来关掉一些装饰图片，再关掉一些导航按钮。要想了解更多，可以看“打印差异”这一篇。
5. 图片替换技巧
一般都建议用标准的HTML来显示文字，而不要使用图片，这样不但快，也更具可读性。但如果你想用一些特殊字体时，就只能用图片了。
比如你想整个卖东西的图标，你就用了这个图片：
&#60;h1&#62;&#60;img src=”widget-image.gif” alt=”Buy widgets” /&#62;&#60;/h1&#62;
这当然可以，但对搜索引擎来说，和正常文字相比，它们对alt里面的替换文字几乎没有兴趣这是因为许多设计者在这里放许多关键词来骗搜索引擎。所以方法应该是这样的：
&#60;h1&#62;Buy widgets&#60;/h1&#62;
但这样就没有特殊字体了。要想达到同样效果，可以这样设计CSS：
h1 { background: url(widget-image.gif) no-repeat; height: image height text-indent: -2000px }
注意把image height换成真的图片的高度。这里，图片会当作背景显示出来，而真正的文字由于设定了-2000像素这个缩进，它们会出现在屏幕左边2000点的地方，就看不见了。但这对于关闭图片的人来说，可能全部看不到了，这点要注意。
6. CSS box模型的另一种调整技巧
这个Box模型的调整主要是针对IE6之前的IE浏览器的，它们把边界宽度和空白都算在元素宽度上。比如：
#box { width:]]></description>
			<content:encoded><![CDATA[<p>在我一个同事的blog里面看到的，搜集过来了。</p>
<p>1.CSS字体属性简写规则一般用CSS设定字体属性是这样做的：</p>
<p>font-weight:bold;<br />
font-style:italic;<br />
font-varient:small-caps;<br />
font-size:1em;<br />
line-height:1.5em;<br />
font-family:verdana,sans-serif;</p>
<p>但也可以把它们全部写到一行上去：</p>
<p><span id="more-74"></span>font: bold italic small-caps 1em/1.5em verdana,sans-serif;</p>
<p>真不错！只有一点要提醒的：这种简写方法只有在同时指定font-size和font-family属性时才起作用。而且，如果你没有设定font-weight, font-style, 以及 font-varient ，他们会使用缺省值，这点要记上。</p>
<p>2. 同时使用两个类</p>
<p>一般只能给一个元素设定一个类（Class），但这并不意味着不能用两个。事实上，你可以这样：</p>
<p>&lt;p class=”text side”&gt;…&lt;/p&gt;</p>
<p>同时给P元素两个类，中间用空格格开，这样所有text和side两个类的属性都会加到P元素上来。如果它们两个类中的属性有冲突的话，后设置的起作用，即在CSS文件中放在后面的类的属性起作用。</p>
<p>补充：对于一个ID，不能这样写&lt;p id=”text side”&gt;…&lt;/p&gt;也不能这样写</p>
<p>3. CSS border的缺省值</p>
<p>通常可以设定边界的颜色，宽度和风格，如：</p>
<p>border: 3px solid #000</p>
<p>这位把边界显示成3像素宽，黑色，实线。但实际上这里只需要指定风格即可。</p>
<p>如果只指定了风格，其他属性就会使用缺省值。一般地，Border的宽度缺省是medium，一般等于3到4个像素；缺省的颜色是其中文字的颜色。如果这个值正好合适的话，就不用设那么多了。</p>
<p>4. CSS用于文档打印</p>
<p>许多网站上都有一个针对打印的版本，但实际上这并不需要，因为可以用CSS来设定打印风格。</p>
<p>也就是说，可以为页面指定两个CSS文件，一个用于屏幕显示，一个用于打印：</p>
<p>&lt;link type=”text/css” rel=”stylesheet” href=”stylesheet.css” media=”screen” /&gt;</p>
<p>&lt;link type=”text/css” rel=”stylesheet” href=”printstyle.css” media=”print” /&gt;</p>
<p>第1行就是显示，第2行是打印，注意其中的media属性。</p>
<p>但应该在打印CSS中写什么东西呢？你可以按设计普通CSS的方法来设定它。设计的同时就可以把这个CSS设成显示CSS来检查它的效果。也许你会使用 display: none 这个命令来关掉一些装饰图片，再关掉一些导航按钮。要想了解更多，可以看“打印差异”这一篇。</p>
<p>5. 图片替换技巧</p>
<p>一般都建议用标准的HTML来显示文字，而不要使用图片，这样不但快，也更具可读性。但如果你想用一些特殊字体时，就只能用图片了。</p>
<p>比如你想整个卖东西的图标，你就用了这个图片：</p>
<p>&lt;h1&gt;&lt;img src=”widget-image.gif” alt=”Buy widgets” /&gt;&lt;/h1&gt;</p>
<p>这当然可以，但对搜索引擎来说，和正常文字相比，它们对alt里面的替换文字几乎没有兴趣这是因为许多设计者在这里放许多关键词来骗搜索引擎。所以方法应该是这样的：</p>
<p>&lt;h1&gt;Buy widgets&lt;/h1&gt;</p>
<p>但这样就没有特殊字体了。要想达到同样效果，可以这样设计CSS：</p>
<p>h1 { background: url(widget-image.gif) no-repeat; height: image height text-indent: -2000px }</p>
<p>注意把image height换成真的图片的高度。这里，图片会当作背景显示出来，而真正的文字由于设定了-2000像素这个缩进，它们会出现在屏幕左边2000点的地方，就看不见了。但这对于关闭图片的人来说，可能全部看不到了，这点要注意。</p>
<p>6. CSS box模型的另一种调整技巧</p>
<p>这个Box模型的调整主要是针对IE6之前的IE浏览器的，它们把边界宽度和空白都算在元素宽度上。比如：</p>
<p>#box { width: 100px; border: 5px; padding: 20px }</p>
<p>这样调用它：</p>
<p>&lt;div id=”box”&gt;…&lt;/div&gt;</p>
<p>这时盒子的全宽应该是150点，这在除IE6之前的IE浏览器之外的所有浏览器上都是正确的。但在IE5这样的浏览器上，它的全宽仍是100点。可以用以前人发明的Box调整方法来处理这种差异。</p>
<p>但用CSS也可以达到同样的目的，让它们显示效果一致。</p>
<p>#box { width: 150px } #box div { border: 5px; padding: 20px }</p>
<p>这样调用：</p>
<p>&lt;div id=”box”&gt;&lt;div&gt;…&lt;/div&gt;&lt;/div&gt;</p>
<p>这样，不管什么浏览器，宽度都是150点了。</p>
<p>7. 块元素居中对齐</p>
<p>如果想做个固定宽度的网页并且想让网页水平居中的话，通常是这样：</p>
<p>#content { width: 700px; margin: 0 auto }</p>
<p>你会使用 &lt;div id=”content”&gt; 来围上所有元素。这很简单，但不够好，IE6之前版本会显示不出这种效果。改CSS如下：</p>
<p>body { text-align: center } #content { text-align: left; width: 700px; margin: 0 auto }</p>
<p>这会把网页内容都居中，所以在Content中又加入了:text-align: left 。</p>
<p>8. 用CSS来处理垂直对齐</p>
<p>垂直对齐用表格可以很方便地实现，设定表格单元 vertical-align: middle 就可以了。但对CSS来说这没用。如果你想设定一个导航条是2em高，而想让导航文字垂直居中的话，设定这个属性是没用的。</p>
<p>CSS方法是什么呢？对了，把这些文字的行高设为 2em：line-height: 2em ，这就可以了。</p>
<p>9. CSS在容器内定位</p>
<p>CSS的一个好处是可以把一个元素任意定位，在一个容器内也可以。比如对这个容器：</p>
<p>#container { position: relative }</p>
<p>这样容器内所有的元素都会相对定位，可以这样用：</p>
<p>&lt;div id=”container”&gt;&lt;div id=”navigation”&gt;…&lt;/div&gt;&lt;/div&gt;</p>
<p>如果想定位到距左30点，距上5点，可以这样：</p>
<p>#navigation { position: absolute; left: 30px; top: 5px }</p>
<p>当然，你还可以这样：</p>
<p>margin: 5px 0 0 30px</p>
<p>注意4个数字的顺序是：上、右、下、左。当然，有时候定位的方法而不是边距的方法更好些。</p>
<p>10. 直通到屏幕底部的背景色</p>
<p>在垂直方向是进行控制是CSS所不能的。如果你想让导航栏和内容栏一样直通到页面底部，用表格是很方便的，但如果只用这样的CSS：</p>
<p>#navigation { background: blue; width: 150px }</p>
<p>较短的导航条是不会直通到底部的，半路内容结束时它就结束了。该怎么办呢？</p>
<p>不幸的是，只能采用欺骗的手段了，给这较短的一栏加上个背景图，宽度和栏宽一样，并让它的颜色和设定的背景色一样。</p>
<p>body { background: url(blue-image.gif) 0 0 repeat-y }</p>
<p>此时不能用em做单位，因为那样的话，一旦读者改变了字体大小，这个花招就会露馅，只能使用px。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xoboy.net/wpblog/tips-10-css-classic/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>再谈IE的hack</title>
		<link>http://www.xoboy.net/wpblog/ie-hack-again/</link>
		<comments>http://www.xoboy.net/wpblog/ie-hack-again/#comments</comments>
		<pubDate>Thu, 14 Jan 2010 06:17:23 +0000</pubDate>
		<dc:creator>xoboy</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[兼容]]></category>
		<category><![CDATA[浏览器]]></category>

		<guid isPermaLink="false">http://www.xoboy.net/wpblog/?p=73</guid>
		<description><![CDATA[最近频频接触CSS，对不同浏览器的显示效果不同很纠结。现再收集一下关于IE的hack。
1. 区别FF和IE
1-1
首先，当然是!important大法，可以提升指定样式规则的应用优先权，如下面的例子：
插入代码：
div{
background-color: red !important;
background-color: blue;
}
因为!important声明在IE6中并不是绝对的，它会被之后的同名属性定义所替换。也就是说在上面的例子中，IE6所应用的是最后一个背景色的值，即“blue”；而在FF中背景色的值为“red”。
1-2
还有一种方法，就是IE浏览器可以识别“&#62;”等一些符号，如“~”、“`”、“
插入代码：
div{
background-color: red;
&#62;background-color: blue;
}
在FF中得到的是背景色红色，而在IE中得到的背景色是蓝色，根据样式重定义的规则，如果浏览器可以识别“&#62;”，则应该得到的蓝色的背景，因此可以知道“&#62;”只有IE可以识别。
这样，我们就可以把FF和IE的样式分离开。下面就是解决IE自己的问题了。
2. 区别IE5.5和IE的其他版本
看一个例子：
插入代码：
div{
&#62;background-color: black;
&#62;background-color /*IE5.5*/: green;
}
这个例子使用了“&#62;”，只有IE可以识别，在IE6中得到了黑色的背景；而在IE5.5中得到的绿色的背景；在IE5中也得到了黑色的背景。这就说明了第二句定义只有IE5.5能识别，这是个很早就公布的HACK，可以在网上找到相关的资料，要注意的就是在属性名之后是有一个空格的。
到此我们已经把FF、IE5.5、IE6分离出来了，那IE5呢？其实现在我们只要把IE5跟IE6分开就OK了。
3. 区别IE5与IE5.5+
插入代码：
div{
&#62;background-color: red;
}
div/*IE5.5+*/{
&#62;background-color: black;
}
这里我们又用到一个HACK，就是“div/**/{}”，这个定义在IE5以上的版本才能识别出来。这个例子得到的结果是，在IE5中的背景色为红色；在IE5以上版本中得到的是黑色背景。
4. 完整的Hack
这样我们就可以为不同的浏览器定义不同的样式了。来看个完整的例子：
插入代码：
div{
width: 500px;
height: 50px;
background-color: red !important;/*FF*/
background-color: blue;/*IE5*/
text-align:center;
}
div/*IE5.5+*/{
&#62;/*IE only*/background-color: black;/*IE6*/
&#62;/*IE only*/background-color /*IE5.5*/: green;
}
需要注意的是，在上面例子中“background-color”定义的顺利不能改变，即FF-IE5-IE6-IE5.5。对于IE的定义在属性前要加“&#62;”，因为“div/**/{}”这个HACK在FF中可以识别。
#hackme{
/*style for all browser here*/
}
* html #hackme{
/*style for ie here*/
}
下面是一个ie6 png hack，用于内联css
height:20px; /*For Firefox*/
*height:25px; /*For IE7 &#38; IE6*/
_height:20px; /*For IE6*/
IE7的hack
IE7 修复了很多 bug，也增加了对一些选择符的支持，所以现在诸如 *html {} 和 html&#62;body {} 等针对 IE 隐藏或显示的 hack]]></description>
			<content:encoded><![CDATA[<p>最近频频接触CSS，对不同浏览器的显示效果不同很纠结。现再收集一下关于IE的hack。</p>
<p>1. 区别FF和IE<br />
1-1<br />
首先，当然是!important大法，可以提升指定样式规则的应用优先权，如下面的例子：<br />
插入代码：<br />
div{<br />
background-color: red !important;<br />
background-color: blue;<br />
}<br />
因为!important声明在IE6中并不是绝对的，它会被之后的同名属性定义所替换。也就是说在上面的例子中，IE6所应用的是最后一个背景色的值，即“blue”；而在FF中背景色的值为“red”。<br />
<span id="more-73"></span>1-2<br />
还有一种方法，就是IE浏览器可以识别“&gt;”等一些符号，如“~”、“`”、“<br />
插入代码：<br />
div{<br />
background-color: red;<br />
&gt;background-color: blue;<br />
}<br />
在FF中得到的是背景色红色，而在IE中得到的背景色是蓝色，根据样式重定义的规则，如果浏览器可以识别“&gt;”，则应该得到的蓝色的背景，因此可以知道“&gt;”只有IE可以识别。<br />
这样，我们就可以把FF和IE的样式分离开。下面就是解决IE自己的问题了。<br />
2. 区别IE5.5和IE的其他版本<br />
看一个例子：<br />
插入代码：<br />
div{<br />
&gt;background-color: black;<br />
&gt;background-color /*IE5.5*/: green;<br />
}<br />
这个例子使用了“&gt;”，只有IE可以识别，在IE6中得到了黑色的背景；而在IE5.5中得到的绿色的背景；在IE5中也得到了黑色的背景。这就说明了第二句定义只有IE5.5能识别，这是个很早就公布的HACK，可以在网上找到相关的资料，要注意的就是在属性名之后是有一个空格的。<br />
到此我们已经把FF、IE5.5、IE6分离出来了，那IE5呢？其实现在我们只要把IE5跟IE6分开就OK了。<br />
3. 区别IE5与IE5.5+<br />
插入代码：<br />
div{<br />
&gt;background-color: red;<br />
}<br />
div/*IE5.5+*/{<br />
&gt;background-color: black;<br />
}<br />
这里我们又用到一个HACK，就是“div/**/{}”，这个定义在IE5以上的版本才能识别出来。这个例子得到的结果是，在IE5中的背景色为红色；在IE5以上版本中得到的是黑色背景。<br />
4. 完整的Hack<br />
这样我们就可以为不同的浏览器定义不同的样式了。来看个完整的例子：<br />
插入代码：<br />
div{<br />
width: 500px;<br />
height: 50px;<br />
background-color: red !important;/*FF*/<br />
background-color: blue;/*IE5*/<br />
text-align:center;<br />
}<br />
div/*IE5.5+*/{<br />
&gt;/*IE only*/background-color: black;/*IE6*/<br />
&gt;/*IE only*/background-color /*IE5.5*/: green;<br />
}<br />
需要注意的是，在上面例子中“background-color”定义的顺利不能改变，即FF-IE5-IE6-IE5.5。对于IE的定义在属性前要加“&gt;”，因为“div/**/{}”这个HACK在FF中可以识别。</p>
<p>#hackme{<br />
/*style for all browser here*/<br />
}</p>
<p>* html #hackme{<br />
/*style for ie here*/<br />
}</p>
<p>下面是一个ie6 png hack，用于内联css</p>
<p>height:20px; /*For Firefox*/<br />
*height:25px; /*For IE7 &amp; IE6*/<br />
_height:20px; /*For IE6*/</p>
<p>IE7的hack<br />
IE7 修复了很多 bug，也增加了对一些选择符的支持，所以现在诸如 *html {} 和 html&gt;body {} 等针对 IE 隐藏或显示的 hack 都会在 IE7 中失效。虽然 CSS Hack 不推荐使用，条件注释才是万无一失的过滤器，但是条件注释只能出现在 HTML 中，CSS Hack 还是有用武之地的。Nanobot 发现了一些针对 IE7 的 CSS Hack，具体就是：</p>
<p>&gt;body<br />
html*<br />
*+html</p>
<p>这三种写法，其中前两种都是不合法的 CSS 写法，在标准兼容浏览器中被被忽略，但是 IE7 却不这么认为。对于 &gt;body ，它会将缺失的选择符用全局选择符 * 代替，也就是将其处理成了 *&gt;body，而且不光对于 &gt; 选择符，+,~ 选择符中这个现象也存在。对于 html* ，由于 html 和 * 之间没有空格，所以也是一种 CSS 语法错误，但 IE7 不会忽略，而是错误地认为这里有一个空格。对于第三种 *+html，IE7 认为 html 前面的 DTD 声明也是一个元素，所以 html 会被选中，这三种方法中只有这一种方法是合法的 CSS 写法，也就是说可以通过校验器的验证，因此也是作者推荐的 hack 用法。<br />
IE 6 and below<br />
Use * html {} to select the html element.<br />
IE 7 and below<br />
Use *+html, * html {} to select the html element.<br />
IE 7 only<br />
Use *+html {} to select the html element.<br />
IE 7 and modern browsers only<br />
Use html&gt;body {} to select the body element.<br />
Modern browsers only (not IE 7)<br />
Use html&gt;/**/body {} to select the body element.<br />
IE的if条件Hack</p>
<p>&lt;!&#8211;[if IE]&gt; Only IE &lt;![endif]&#8211;&gt;<br />
所有的IE可识别<br />
&lt;!&#8211;[if IE 5.0]&gt; Only IE 5.0 &lt;![endif]&#8211;&gt;<br />
只有IE5.0可以识别<br />
&lt;!&#8211;[if gt IE 5.0]&gt; Only IE 5.0+ &lt;![endif]&#8211;&gt;<br />
IE5.0包换IE5.5都可以识别<br />
&lt;!&#8211;[if lt IE 6]&gt; Only IE 6- &lt;![endif]&#8211;&gt;<br />
仅IE6可识别<br />
&lt;!&#8211;[if gte IE 6]&gt; Only IE 6/+ &lt;![endif]&#8211;&gt;<br />
IE6以及IE6以下的IE5.x都可识别<br />
&lt;!&#8211;[if lte IE 7]&gt; Only IE 7/- &lt;![endif]&#8211;&gt;<br />
仅IE7可识别</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xoboy.net/wpblog/ie-hack-again/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>补充说明图片垂直居中的问题</title>
		<link>http://www.xoboy.net/wpblog/image-vertical-align/</link>
		<comments>http://www.xoboy.net/wpblog/image-vertical-align/#comments</comments>
		<pubDate>Thu, 14 Jan 2010 05:03:23 +0000</pubDate>
		<dc:creator>xoboy</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[浏览器]]></category>

		<guid isPermaLink="false">http://www.xoboy.net/wpblog/?p=71</guid>
		<description><![CDATA[由于IE与Firefox对CSS的解释不同，往往让我们在对一个图片处于一个div内垂直居中的问题伤透脑筋。上一篇讲述到用top:50%的方法，现在再展开补充说明一下。
首先我们定义一个放置图片的容器
.box{width:600px; height:300px; display:table; border:1px solid #000; background-color:#CCCCCC;}
为了更清楚看到效果，我定义了这个box的边框和背景色。
然后我们在这个容器内再多放置一个
.imgbox {display:table-cell; vertical-align:middle; text-align:center;}
由于IE不支持CSS2中的display:table和display:table-cell，而对于能解释这两个属性的浏览器来说，做到垂直局中到这里就已经足够了。因此我们要针对IE再下点功夫。对htm我们可以这样写：
&#60;div class=&#8221;box&#8221;&#62;
　&#60;div class=&#8221;imgbox&#8221;&#62;&#60;p&#62;&#60;img src=&#8221;图片的位置&#8221; /&#62;&#60;/p&#62;&#60;/div&#62;
&#60;/div&#62;
然后针对IE我们补充hack的内容：
.box {*position:relative;}
.imgbox {*width:100%;*position:absolute; *top:50%; *left:0;}
　.imgbox p {*position: relative; *top:-50%; *margin:0; *padding:0;}
　.imgbox img{ *margin-top:4px;}
对IE来说，用了绝对定位和相对定位，通过两次50%的偏移找到了图片所在div的中心，因此完整的CSS应该为：
.box { width:600px; height:300px; display:table; border:1px solid #000; background-color:#CCCCCC; *position:relative;} /*这个层的长宽可以自定义*/
.imgbox { display:table-cell; vertical-align:middle; text-align:center; *width:100%; *position:absolute;  *top:50%; *left:0;}
　.imgbox p {*position: relative; *top:-50%; *margin:0; *padding:0;}
　.imgbox img{ *margin-top:4px;}
大功告成！
]]></description>
			<content:encoded><![CDATA[<p>由于IE与Firefox对CSS的解释不同，往往让我们在对一个图片处于一个div内垂直居中的问题伤透脑筋。上一篇讲述到用top:50%的方法，现在再展开补充说明一下。</p>
<p><span id="more-71"></span>首先我们定义一个放置图片的容器</p>
<p>.box{width:600px; height:300px; display:table; border:1px solid #000; background-color:#CCCCCC;}</p>
<p>为了更清楚看到效果，我定义了这个box的边框和背景色。</p>
<p>然后我们在这个容器内再多放置一个</p>
<p>.imgbox {display:table-cell; vertical-align:middle; text-align:center;}</p>
<p>由于IE不支持CSS2中的display:table和display:table-cell，而对于能解释这两个属性的浏览器来说，做到垂直局中到这里就已经足够了。因此我们要针对IE再下点功夫。对htm我们可以这样写：</p>
<p>&lt;div class=&#8221;box&#8221;&gt;<br />
　&lt;div class=&#8221;imgbox&#8221;&gt;&lt;p&gt;&lt;img src=&#8221;图片的位置&#8221; /&gt;&lt;/p&gt;&lt;/div&gt;<br />
&lt;/div&gt;</p>
<p>然后针对IE我们补充hack的内容：</p>
<p>.box {*position:relative;}<br />
.imgbox {*width:100%;*position:absolute; *top:50%; *left:0;}<br />
　.imgbox p {*position: relative; *top:-50%; *margin:0; *padding:0;}<br />
　.imgbox img{ *margin-top:4px;}</p>
<p>对IE来说，用了绝对定位和相对定位，通过两次50%的偏移找到了图片所在div的中心，因此完整的CSS应该为：</p>
<p>.box { width:600px; height:300px; display:table; border:1px solid #000; background-color:#CCCCCC; *position:relative;} /*这个层的长宽可以自定义*/<br />
.imgbox { display:table-cell; vertical-align:middle; text-align:center; *width:100%; *position:absolute;  *top:50%; *left:0;}<br />
　.imgbox p {*position: relative; *top:-50%; *margin:0; *padding:0;}<br />
　.imgbox img{ *margin-top:4px;}</p>
<p>大功告成！</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xoboy.net/wpblog/image-vertical-align/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>几个CSS的技巧</title>
		<link>http://www.xoboy.net/wpblog/several-css-skill/</link>
		<comments>http://www.xoboy.net/wpblog/several-css-skill/#comments</comments>
		<pubDate>Tue, 29 Dec 2009 09:48:54 +0000</pubDate>
		<dc:creator>xoboy</dc:creator>
				<category><![CDATA[Artcle]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[图片]]></category>

		<guid isPermaLink="false">http://www.xoboy.net/wpblog/?p=70</guid>
		<description><![CDATA[很多朋友在编写html的时候往往会被一些小问题所困扰，这里介绍几个小小的技巧。
1. 防止图片撑破div层
.div-img {margin: auto; width: 600px;}
.div-img img{max-width: 100%!important; height: auto!important; width:expression(this.width &#62; 600 ? &#8220;600px&#8221; : this.width)!important;}
2. 让div的内容图片垂直居中（可兼容多浏览器）
.div-img {*position:absolute; top:50%;}
.div-img img {*position:relative; top:-50%; left:-50%;}
3. 让文字从右往左竖排写
.text { layout-flow: vertical-ideographic; height:400px; line-height:200%; }
]]></description>
			<content:encoded><![CDATA[<p>很多朋友在编写html的时候往往会被一些小问题所困扰，这里介绍几个小小的技巧。</p>
<p>1. 防止图片撑破div层</p>
<p>.div-img {margin: auto; width: 600px;}<br />
.div-img img{max-width: 100%!important; height: auto!important; width:expression(this.width &gt; 600 ? &#8220;600px&#8221; : this.width)!important;}</p>
<p>2. 让div的内容图片垂直居中（可兼容多浏览器）</p>
<p>.div-img {*position:absolute; top:50%;}<br />
.div-img img {*position:relative; top:-50%; left:-50%;}</p>
<p>3. 让文字从右往左竖排写</p>
<p>.text { layout-flow: vertical-ideographic; height:400px; line-height:200%; }</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xoboy.net/wpblog/several-css-skill/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>简单而实用的CSS属性：min-height</title>
		<link>http://www.xoboy.net/wpblog/css-min-height/</link>
		<comments>http://www.xoboy.net/wpblog/css-min-height/#comments</comments>
		<pubDate>Fri, 11 Dec 2009 08:07:42 +0000</pubDate>
		<dc:creator>xoboy</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[IE6]]></category>

		<guid isPermaLink="false">http://www.xoboy.net/wpblog/?p=68</guid>
		<description><![CDATA[今天讲解一下一个简单而实用的CSS属性：min-height，它允许你指定元素的最小高度，在需要平衡布局时非常有用。看看下面的图解就一目了然了。
 
一般写法：
.with_minheight {
　　min-height: 550px;
}
但需要注意的是，IE6不支持min-height（又一个要杀死IE6的理由），但是有一个min-height hack的写法：
 .with_minheight {
　　min-height:550px;
　　height:auto !important;
　　height:550px;
}
以后在进行多栏式的布局时可以用这个属性控制美观度:coolsmile:
]]></description>
			<content:encoded><![CDATA[<p>今天讲解一下一个简单而实用的CSS属性：min-height，它允许你指定元素的最小高度，在需要平衡布局时非常有用。看看下面的图解就一目了然了。<span id="more-68"></span></p>
<p><img src="http://uh.9ria.com/attachment/200912/9/7297_12603705123hSH.gif" alt="" width="470" height="270" /> </p>
<p>一般写法：</p>
<p>.with_minheight {<br />
　　min-height: 550px;<br />
}</p>
<p>但需要注意的是，IE6不支持min-height（又一个要杀死IE6的理由），但是有一个min-height hack的写法：</p>
<p> .with_minheight {<br />
　　min-height:550px;<br />
　　height:auto !important;<br />
　　height:550px;<br />
}</p>
<p>以后在进行多栏式的布局时可以用这个属性控制美观度:coolsmile:</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xoboy.net/wpblog/css-min-height/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IE6 must DIE</title>
		<link>http://www.xoboy.net/wpblog/ie6-must-die/</link>
		<comments>http://www.xoboy.net/wpblog/ie6-must-die/#comments</comments>
		<pubDate>Sun, 08 Nov 2009 16:07:15 +0000</pubDate>
		<dc:creator>xoboy</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[IE6]]></category>
		<category><![CDATA[netscape]]></category>
		<category><![CDATA[png]]></category>
		<category><![CDATA[widget]]></category>
		<category><![CDATA[设计]]></category>

		<guid isPermaLink="false">http://www.xoboy.net/wpblog/?p=67</guid>
		<description><![CDATA[Internet Explorer 6 is outdated and insecure, it looked terrible, but many users still using it.
Adding the NOTIFICATION on your site to help phase out Internet Explorer 6 forever. They tells visitors using Internet Explorer 6 that they need to upgrade to the current version or switch to another browser right now.


Internet Explorer 6 曾经是浏览器的霸主，击垮]]></description>
			<content:encoded><![CDATA[<p>Internet Explorer 6 is outdated and insecure, it looked terrible, but many users still using it.</p>
<p>Adding the NOTIFICATION on your site to help phase out Internet Explorer 6 forever. They tells visitors using Internet Explorer 6 that they need to upgrade to the current version or switch to another browser right now.</p>
<p><img src="http://farm3.static.flickr.com/2454/3765906168_da58f4b9f1_o.gif" alt="Let's Kill IE6" width="340" height="154" /></p>
<p><span id="more-67"></span></p>
<p><strong>Internet Explorer 6</strong> 曾经是浏览器的霸主，击垮 Netscape 并最终占据 95% 的浏览器市场。但如今已经功能性能落后，还需要特殊照顾，被称为”阻碍网络技术向前发展的障碍“。在我为其他企业设计网站页面时，为了迎合IE6的需要，往往花费了大量时间和精力。</p>
<p><strong>为什么IE6要死</strong>？从一个页面设计师的角度看，有如下致命的两点：</p>
<p>1. PNG 是一种支持半透明通道的图片，可以方便的用于设计网页，制作叠层和其他复杂的页面效果，但是 IE6 不支持，用滤镜强行应付会导致浏览器占用超高资源，并且得不到预想效果！</p>
<p>2. IE6 有自己一套标准的 CSS 样式，必须写更多的代码去照顾它。</p>
<p>为了响应“IE6 must DIE”的活动，我在网站上加入了一个widget，有兴趣的朋友只需要在&lt;body&gt;标签内加入如下代码，便能为杀死IE6出一份力了！</p>
<pre class="html" style="font-family: monospace;">&lt;!--[if lte IE 6]&gt;
&lt;script src="http://letskillie6.googlecode.com/svn/trunk/letskillie6.zh_CN.pack.js"&gt;&lt;/script&gt;
&lt;![endif]--&gt;</pre>
<p><strong>其他语言版本：</strong></p>
<p>Let&#8217;s kill Internet Explorer 6, copy and paste this code before your closing <code>&lt;/body&gt;</code> tag.</p>
<p><strong>English</strong><br />
<small><a rel="external nofollow" href="http://letskillie6.googlecode.com/svn/trunk/sample.html">Demo</a></small></p>
<div class="wp_syntax">
<div class="code">
<pre class="html" style="font-family: monospace;">&lt;!--[if lte IE 6]&gt;
&lt;script src="http://letskillie6.googlecode.com/svn/trunk/letskillie6.pack.js"&gt;&lt;/script&gt;
&lt;![endif]--&gt;</pre>
</div>
</div>
<p><strong>简体中文</strong><br />
<small><a rel="external nofollow" href="http://letskillie6.googlecode.com/svn/trunk/sample.zh_CN.html">Demo</a></small></p>
<div class="wp_syntax">
<div class="code">
<pre class="html" style="font-family: monospace;">&lt;!--[if lte IE 6]&gt;
&lt;script src="http://letskillie6.googlecode.com/svn/trunk/letskillie6.zh_CN.pack.js"&gt;&lt;/script&gt;
&lt;![endif]--&gt;</pre>
</div>
</div>
<p><strong>繁體中文</strong><br />
<small><a rel="external nofollow" href="http://letskillie6.googlecode.com/svn/trunk/sample.zh_TW.html">Demo</a> | Translated by <a rel="external nofollow" href="http://www.cracky.atbhost.net/">Cracky冰</a></small></p>
<div class="wp_syntax">
<div class="code">
<pre class="html" style="font-family: monospace;">&lt;!--[if lte IE 6]&gt;
&lt;script src="http://letskillie6.googlecode.com/svn/trunk/letskillie6.zh_TW.pack.js"&gt;&lt;/script&gt;
&lt;![endif]--&gt;</pre>
</div>
</div>
<p><strong>Arabic</strong><br />
<small><a rel="external nofollow" href="http://letskillie6.googlecode.com/svn/trunk/sample.ar.html">Demo</a> | Translated by <a rel="external nofollow" href="http://abdullah-kh.com/b/">Abdullah</a></small></p>
<div class="wp_syntax">
<div class="code">
<pre class="html" style="font-family: monospace;">&lt;!--[if lte IE 6]&gt;
&lt;script src="http://letskillie6.googlecode.com/svn/trunk/letskillie6.ar.pack.js"&gt;&lt;/script&gt;
&lt;![endif]--&gt;</pre>
</div>
</div>
<p><strong>Brazillian Portuguese</strong><br />
<small><a rel="external nofollow" href="http://letskillie6.googlecode.com/svn/trunk/sample.br_BR.html">Demo</a> | Translated by <a rel="external nofollow" href="http://www.franklimsp.com.br/">Franklim Pagung</a></small></p>
<div class="wp_syntax">
<div class="code">
<pre class="html" style="font-family: monospace;">&lt;!--[if lte IE 6]&gt;
&lt;script src="http://letskillie6.googlecode.com/svn/trunk/letskillie6.br_BR.pack.js"&gt;&lt;/script&gt;
&lt;![endif]--&gt;</pre>
</div>
</div>
<p><strong>Dutch</strong><br />
<small><a rel="external nofollow" href="http://letskillie6.googlecode.com/svn/trunk/sample.nl_NL.html">Demo</a> | Translated by <a rel="external nofollow" href="http://www.ghengeveld.nl/">Gert Hengeveld</a></small></p>
<div class="wp_syntax">
<div class="code">
<pre class="html" style="font-family: monospace;">&lt;!--[if lte IE 6]&gt;
&lt;script src="http://letskillie6.googlecode.com/svn/trunk/letskillie6.nl_NL.pack.js"&gt;&lt;/script&gt;
&lt;![endif]--&gt;</pre>
</div>
</div>
<p><strong>Finnish</strong><br />
<small><a rel="external nofollow" href="http://letskillie6.googlecode.com/svn/trunk/sample.fi.html">Demo</a> | Translated by Legacy</small></p>
<div class="wp_syntax">
<div class="code">
<pre class="html" style="font-family: monospace;">&lt;!--[if lte IE 6]&gt;
&lt;script src="http://letskillie6.googlecode.com/svn/trunk/letskillie6.fi.pack.js"&gt;&lt;/script&gt;
&lt;![endif]--&gt;</pre>
</div>
</div>
<p><strong>French/Français</strong><br />
<small><a rel="external nofollow" href="http://letskillie6.googlecode.com/svn/trunk/sample.fr_FR.html">Demo</a> | Translated by Simon Pireyn</small></p>
<div class="wp_syntax">
<div class="code">
<pre class="html" style="font-family: monospace;">&lt;!--[if lte IE 6]&gt;
&lt;script src="http://letskillie6.googlecode.com/svn/trunk/letskillie6.fr_FR.pack.js"&gt;&lt;/script&gt;
&lt;![endif]--&gt;</pre>
</div>
</div>
<p><strong>German</strong><br />
<small><a rel="external nofollow" href="http://letskillie6.googlecode.com/svn/trunk/sample.de_DE.html">Demo</a> | Translated by Andre</small></p>
<div class="wp_syntax">
<div class="code">
<pre class="html" style="font-family: monospace;">&lt;!--[if lte IE 6]&gt;
&lt;script src="http://letskillie6.googlecode.com/svn/trunk/letskillie6.de_DE.pack.js"&gt;&lt;/script&gt;
&lt;![endif]--&gt;</pre>
</div>
</div>
<p><strong>Greek</strong><br />
<small><a rel="external nofollow" href="http://letskillie6.googlecode.com/svn/trunk/sample.gr.html">Demo</a> | Translated by Konstantinos Rousis</small></p>
<div class="wp_syntax">
<div class="code">
<pre class="html" style="font-family: monospace;">&lt;!--[if lte IE 6]&gt;
&lt;script src="http://letskillie6.googlecode.com/svn/trunk/letskillie6.gr.pack.js"&gt;&lt;/script&gt;
&lt;![endif]--&gt;</pre>
</div>
</div>
<p><strong>Hindi</strong><br />
<small><a rel="external nofollow" href="http://letskillie6.googlecode.com/svn/trunk/sample.hi_IN.html">Demo</a> | Translated by <a rel="external nofollow" href="http://www.gtricks.com/">Abhishek Mandloi</a></small></p>
<div class="wp_syntax">
<div class="code">
<pre class="html" style="font-family: monospace;">&lt;!--[if lte IE 6]&gt;
&lt;script src="http://letskillie6.googlecode.com/svn/trunk/letskillie6.hi_IN.pack.js"&gt;&lt;/script&gt;
&lt;![endif]--&gt;</pre>
</div>
</div>
<p><strong>Hungarian</strong><br />
<small><a rel="external nofollow" href="http://letskillie6.googlecode.com/svn/trunk/sample.hu_HU.html">Demo</a> | Translated by Muzsi János</small></p>
<div class="wp_syntax">
<div class="code">
<pre class="html" style="font-family: monospace;">&lt;!--[if lte IE 6]&gt;
&lt;script src="http://letskillie6.googlecode.com/svn/trunk/letskillie6.hu_HU.pack.js"&gt;&lt;/script&gt;
&lt;![endif]--&gt;</pre>
</div>
</div>
<p><strong>Italian</strong><br />
<small><a rel="external nofollow" href="http://letskillie6.googlecode.com/svn/trunk/sample.it_IT.html">Demo</a> | Translated by Rui</small></p>
<div class="wp_syntax">
<div class="code">
<pre class="html" style="font-family: monospace;">&lt;!--[if lte IE 6]&gt;
&lt;script src="http://letskillie6.googlecode.com/svn/trunk/letskillie6.it_IT.pack.js"&gt;&lt;/script&gt;
&lt;![endif]--&gt;</pre>
</div>
</div>
<p><strong>Indonesia</strong><br />
<small><a rel="external nofollow" href="http://letskillie6.googlecode.com/svn/trunk/sample.id_ID.html">Demo</a> | Translated by <a rel="external nofollow" href="http://arifn.web.id/">Arif N</a></small></p>
<div class="wp_syntax">
<div class="code">
<pre class="html" style="font-family: monospace;">&lt;!--[if lte IE 6]&gt;
&lt;script src="http://letskillie6.googlecode.com/svn/trunk/letskillie6.id_ID.pack.js"&gt;&lt;/script&gt;
&lt;![endif]--&gt;</pre>
</div>
</div>
<p><strong>Japanese/日本語</strong><br />
<small><a rel="external nofollow" href="http://letskillie6.googlecode.com/svn/trunk/sample.ja.html">Demo</a> | Translated by <a rel="external nofollow" href="http://www.loveehome.org/">lovee</a></small></p>
<div class="wp_syntax">
<div class="code">
<pre class="html" style="font-family: monospace;">&lt;!--[if lte IE 6]&gt;
&lt;script src="http://letskillie6.googlecode.com/svn/trunk/letskillie6.ja.pack.js"&gt;&lt;/script&gt;
&lt;![endif]--&gt;</pre>
</div>
</div>
<p><strong>Javanese</strong><br />
<small><a rel="external nofollow" href="http://letskillie6.googlecode.com/svn/trunk/sample.javanese.html">Demo</a> | Translated by <a rel="external nofollow" href="http://sagung.wordpress.com/">Sagung Aditya</a></small></p>
<div class="wp_syntax">
<div class="code">
<pre class="html" style="font-family: monospace;">&lt;!--[if lte IE 6]&gt;
&lt;script src="http://letskillie6.googlecode.com/svn/trunk/letskillie6.javanese.pack.js"&gt;&lt;/script&gt;
&lt;![endif]--&gt;</pre>
</div>
</div>
<p><strong>Norwegian</strong><br />
<small><a rel="external nofollow" href="http://letskillie6.googlecode.com/svn/trunk/sample.nb_NO.html">Demo</a> | Translated by Ingebjørg</small></p>
<div class="wp_syntax">
<div class="code">
<pre class="html" style="font-family: monospace;">&lt;!--[if lte IE 6]&gt;
&lt;script src="http://letskillie6.googlecode.com/svn/trunk/letskillie6.nb_NO.pack.js"&gt;&lt;/script&gt;
&lt;![endif]--&gt;</pre>
</div>
</div>
<p><strong>Polish</strong><br />
<small><a rel="external nofollow" href="http://letskillie6.googlecode.com/svn/trunk/sample.pl_PL.html">Demo</a> | Translated by <a rel="external nofollow" href="http://www.pikor.net/">Cezar</a></small></p>
<div class="wp_syntax">
<div class="code">
<pre class="html" style="font-family: monospace;">&lt;!--[if lte IE 6]&gt;
&lt;script src="http://letskillie6.googlecode.com/svn/trunk/letskillie6.pl_PL.pack.js"&gt;&lt;/script&gt;
&lt;![endif]--&gt;</pre>
</div>
</div>
<p><strong>Portuguese</strong><br />
<small><a rel="external nofollow" href="http://letskillie6.googlecode.com/svn/trunk/sample.pt_PT.html">Demo</a> | Translated by João José</small></p>
<div class="wp_syntax">
<div class="code">
<pre class="html" style="font-family: monospace;">&lt;!--[if lte IE 6]&gt;
&lt;script src="http://letskillie6.googlecode.com/svn/trunk/letskillie6.pt_PT.pack.js"&gt;&lt;/script&gt;
&lt;![endif]--&gt;</pre>
</div>
</div>
<p><strong>Romanian</strong><br />
<small><a rel="external nofollow" href="http://letskillie6.googlecode.com/svn/trunk/sample.ro_RO.html">Demo</a> | Translated by <a rel="external nofollow" href="http://www.tridentdesign.com/">Adrian Sandu</a></small></p>
<div class="wp_syntax">
<div class="code">
<pre class="html" style="font-family: monospace;">&lt;!--[if lte IE 6]&gt;
&lt;script src="http://letskillie6.googlecode.com/svn/trunk/letskillie6.ro_RO.pack.js"&gt;&lt;/script&gt;
&lt;![endif]--&gt;</pre>
</div>
</div>
<p><strong>Russian</strong><br />
<small><a rel="external nofollow" href="http://letskillie6.googlecode.com/svn/trunk/sample.ru_RU.html">Demo</a> | Translated by <a rel="external nofollow" href="http://www.siniy.ws/">Alexandr Sinitsin</a></small></p>
<div class="wp_syntax">
<div class="code">
<pre class="html" style="font-family: monospace;">&lt;!--[if lte IE 6]&gt;
&lt;script src="http://letskillie6.googlecode.com/svn/trunk/letskillie6.ru_RU.pack.js"&gt;&lt;/script&gt;
&lt;![endif]--&gt;</pre>
</div>
</div>
<p><strong>Spanish</strong><br />
<small><a rel="external nofollow" href="http://letskillie6.googlecode.com/svn/trunk/sample.es_ES.html">Demo</a> | Translated by <a rel="external nofollow" href="http://www.fdsign.com/">Coco</a></small></p>
<div class="wp_syntax">
<div class="code">
<pre class="html" style="font-family: monospace;">&lt;!--[if lte IE 6]&gt;
&lt;script src="http://letskillie6.googlecode.com/svn/trunk/letskillie6.es_ES.pack.js"&gt;&lt;/script&gt;
&lt;![endif]--&gt;</pre>
</div>
</div>
<p><strong>Swedish</strong><br />
<small><a rel="external nofollow" href="http://letskillie6.googlecode.com/svn/trunk/sample.sv_SE.html">Demo</a> | Translated by <a rel="external nofollow" href="http://www.edgefive.com/">J. Nyman</a></small></p>
<div class="wp_syntax">
<div class="code">
<pre class="html" style="font-family: monospace;">&lt;!--[if lte IE 6]&gt;
&lt;script src="http://letskillie6.googlecode.com/svn/trunk/letskillie6.sv_SE.pack.js"&gt;&lt;/script&gt;
&lt;![endif]--&gt;</pre>
</div>
</div>
<p><strong>Thai</strong><br />
<small><a rel="external nofollow" href="http://letskillie6.googlecode.com/svn/trunk/sample.th.html">Demo</a> | Translated by <a rel="external nofollow" href="http://www.thaianime.net/">ThaiAnime</a></small></p>
<div class="wp_syntax">
<div class="code">
<pre class="html" style="font-family: monospace;">&lt;!--[if lte IE 6]&gt;
&lt;script src="http://letskillie6.googlecode.com/svn/trunk/letskillie6.th.pack.js"&gt;&lt;/script&gt;
&lt;![endif]--&gt;</pre>
</div>
</div>
<p><strong>Bilingual (English &amp; 简体中文)</strong><br />
<small><a rel="external nofollow" href="http://letskillie6.googlecode.com/svn/trunk/sample.bilingual.html">Demo</a></small></p>
<div class="wp_syntax">
<div class="code">
<pre class="html" style="font-family: monospace;">&lt;!--[if lte IE 6]&gt;
&lt;script src="http://letskillie6.googlecode.com/svn/trunk/letskillie6.bilingual.pack.js"&gt;&lt;/script&gt;
&lt;![endif]--&gt;</pre>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.xoboy.net/wpblog/ie6-must-die/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>什么是CSS hack</title>
		<link>http://www.xoboy.net/wpblog/what_is_css_hack/</link>
		<comments>http://www.xoboy.net/wpblog/what_is_css_hack/#comments</comments>
		<pubDate>Fri, 28 Aug 2009 03:44:28 +0000</pubDate>
		<dc:creator>xoboy</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[代码]]></category>
		<category><![CDATA[兼容]]></category>
		<category><![CDATA[浏览器]]></category>

		<guid isPermaLink="false">http://www.xoboy.net/wpblog/?p=64</guid>
		<description><![CDATA[由于不同的浏览器，比如Internet Explorer 6,Internet Explorer 7,Mozilla Firefox等，对CSS的解析认识不一样，因此会导致生成的页面效果不一样，得不到我们所需要的页面效果。
这个时候我们就需要针对不同的浏览器去写不同的CSS，让它能够同时兼容不同的浏览器，能在不同的浏览器中也能得到我们想要的页面效果。
这个针对不同的浏览器写不同的CSS code的过程，就叫CSS hack,也叫写CSS hack。
CSS Hack的原理是什么
由于不同的浏览器对CSS的支持及解析结果不一样，还由于CSS中的优先级的关系。我们就可以根据这个来针对不同的浏览器来写不同的CSS。
比如 IE6能识别下划线_和星号*，IE7能识别星号*，当不能识别下划线_，而firefox两个都不能认识。等等
书写顺序，一般是将识别能力强的浏览器的CSS写在后面。下面如何写里面说得更详细些。
如何写CSS Hack
比如要分辨IE6和firefox两种浏览器，可以这样写：
&#60;style&#62;   
div{   
background:green; /* for firefox */   
*background:red; /* for IE6 */   
}   
&#60;/style&#62;   
&#60;div&#62;我在IE6中看到是红色的，在firefox中看到是绿色的。&#60;/div&#62;
&#60;style&#62;
div{
background:green; /* for firefox */
*background:red; /* for IE6 */
}
&#60;/style&#62;
&#60;div&#62;我在IE6中看到是红色的，在firefox中看到是绿色的。&#60;/div&#62;
解释一下：

上面的css在firefox中，它是认识不了后面的那个带星号*的东东是什么的，于是将它过滤掉，不予理睬，解析得到的结果是:div{background:green},于是理所当然这个div的背景是绿色的。
 
在IE6中呢，它两个background都能识别出来，它解析得到的结果是:div{background:green;background:red;},于是根据优先级别，处在后面的red的优先级高，于是当然这个div的背景颜色就是红色的了。
CSS hack:区分IE6，IE7，firefox区别不同浏览器，CSS hack写法：
区别IE6与FF：
background:orange;*background:blue;
background:orange;*background:blue;
区别IE6与IE7：
background:green !important;background:blue;
background:green !important;background:blue;
区别IE7与FF：
background:orange; *background:green;
background:orange; *background:green;
区别FF，IE7，IE6：
background:orange;*background:green !important;*background:blue;
background:orange;*background:green !important;*background:blue;
注：IE都能识别*;标准浏览器(如FF)不能识别*；

IE6能识别*，但不能识别 !important,
IE7能识别*，也能识别!important;
FF不能识别*，但能识别!important;




 
IE6
IE7
FF


*
  √
  √
 ×


!important
  ×
  √
 √



另外再补充一个，下划线”_”, IE6支持下划线，IE7和firefox均不支持下划线。
于是大家还可以这样来区分IE6，IE7，firefox
div{: background:orange;  
*background:green;  
_background:blue;}
div{: background:orange;
*background:green;
_background:blue;}
注：不管是什么方法，书写的顺序都是firefox的写在前面，IE7的写在中间，IE6的写在最后面
付:CSS hack 列表图
]]></description>
			<content:encoded><![CDATA[<p>由于不同的浏览器，比如Internet Explorer 6,Internet Explorer 7,Mozilla Firefox等，对CSS的解析认识不一样，因此会导致生成的页面效果不一样，得不到我们所需要的页面效果。</p>
<p>这个时候我们就需要针对不同的浏览器去写不同的CSS，让它能够同时兼容不同的浏览器，能在不同的浏览器中也能得到我们想要的页面效果。</p>
<p>这个针对不同的浏览器写不同的CSS code的过程，就叫CSS hack,也叫写CSS hack。</p>
<h3>CSS Hack的原理是什么</h3>
<p>由于不同的浏览器对CSS的支持及解析结果不一样，还由于CSS中的优先级的关系。我们就可以根据这个来针对不同的浏览器来写不同的CSS。</p>
<p><span id="more-64"></span>比如 IE6能识别下划线_和星号*，IE7能识别星号*，当不能识别下划线_，而firefox两个都不能认识。等等</p>
<p>书写顺序，一般是将识别能力强的浏览器的CSS写在后面。下面如何写里面说得更详细些。</p>
<h3>如何写CSS Hack</h3>
<p>比如要分辨IE6和firefox两种浏览器，可以这样写：</p>
<p class="code">&lt;style&gt;   <br />
div{   <br />
background:green; /* for firefox */   <br />
*background:red; /* for IE6 */   <br />
}   <br />
&lt;/style&gt;   <br />
&lt;div&gt;我在IE6中看到是红色的，在firefox中看到是绿色的。&lt;/div&gt;<br />
&lt;style&gt;<br />
div{<br />
background:green; /* for firefox */<br />
*background:red; /* for IE6 */<br />
}<br />
&lt;/style&gt;<br />
&lt;div&gt;我在IE6中看到是红色的，在firefox中看到是绿色的。&lt;/div&gt;</p>
<p><strong>解释一下：<br />
</strong><br />
上面的css在firefox中，它是认识不了后面的那个带星号*的东东是什么的，于是将它过滤掉，不予理睬，解析得到的结果是:div{background:green},于是理所当然这个div的背景是绿色的。</p>
<p> </p>
<p>在IE6中呢，它两个background都能识别出来，它解析得到的结果是:div{background:green;background:red;},于是根据优先级别，处在后面的red的优先级高，于是当然这个div的背景颜色就是红色的了。</p>
<p>CSS hack:区分IE6，IE7，firefox区别不同浏览器，CSS hack写法：</p>
<p>区别IE6与FF：</p>
<p class="code">background:orange;*background:blue;<br />
background:orange;*background:blue;</p>
<p>区别IE6与IE7：</p>
<p class="code">background:green !important;background:blue;<br />
background:green !important;background:blue;</p>
<p>区别IE7与FF：</p>
<p class="code">background:orange; *background:green;<br />
background:orange; *background:green;</p>
<p>区别FF，IE7，IE6：</p>
<p class="code">background:orange;*background:green !important;*background:blue;<br />
background:orange;*background:green !important;*background:blue;</p>
<p>注：IE都能识别*;标准浏览器(如FF)不能识别*；</p>
<ul>
<li>IE6能识别*，但不能识别 !important,</li>
<li>IE7能识别*，也能识别!important;</li>
<li>FF不能识别*，但能识别!important;</li>
</ul>
<table border="0">
<tbody>
<tr>
<th> </th>
<th>IE6</th>
<th>IE7</th>
<th>FF</th>
</tr>
<tr>
<td>*</td>
<td>  √</td>
<td>  √</td>
<td> ×</td>
</tr>
<tr>
<td>!important</td>
<td>  ×</td>
<td>  √</td>
<td> √</td>
</tr>
</tbody>
</table>
<p>另外再补充一个，下划线”_”, IE6支持下划线，IE7和firefox均不支持下划线。</p>
<p>于是大家还可以这样来区分IE6，IE7，firefox</p>
<p class="code">div{: background:orange;  <br />
*background:green;  <br />
_background:blue;}<br />
div{: background:orange;<br />
*background:green;<br />
_background:blue;}</p>
<p>注：不管是什么方法，书写的顺序都是firefox的写在前面，IE7的写在中间，IE6的写在最后面</p>
<p>付:<a href="http://www.xoboy.net/wpblog/wp-content/uploads/2009/08/css_buglist.gif" target="_blank">CSS hack 列表图</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.xoboy.net/wpblog/what_is_css_hack/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>主页的重新设计</title>
		<link>http://www.xoboy.net/wpblog/website-design/</link>
		<comments>http://www.xoboy.net/wpblog/website-design/#comments</comments>
		<pubDate>Sun, 13 Apr 2008 17:19:23 +0000</pubDate>
		<dc:creator>xoboy</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[设计]]></category>

		<guid isPermaLink="false">http://www.xoboy.net/wpblog/?p=9</guid>
		<description><![CDATA[最近在作www.xoboy.net主页的重新设计，其实一直都很想做一个比较特别的主页，但因为自己懒，也没有很好的创意，一直都把它丢空了。突然有这个想法，却来源于在国外网站看到了一个非常棒的CSS效果。由于工程比较浩大，业余的时间也不太够，因此进度一直比较缓慢。不过我自己也非常期待它的面世，就像自己的孩子:)
给点耐心自己吧……
]]></description>
			<content:encoded><![CDATA[<p>最近在作www.xoboy.net主页的重新设计，其实一直都很想做一个比较特别的主页，但因为自己懒，也没有很好的创意，一直都把它丢空了。突然有这个想法，却来源于在国外网站看到了一个非常棒的CSS效果。由于工程比较浩大，业余的时间也不太够，因此进度一直比较缓慢。不过我自己也非常期待它的面世，就像自己的孩子:)</p>
<p>给点耐心自己吧……</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xoboy.net/wpblog/website-design/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

