<?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>一阁 &#187; Css</title>
	<atom:link href="http://www.yigle.net/category/web-tech/css/feed" rel="self" type="application/rss+xml" />
	<link>http://www.yigle.net</link>
	<description>学习,生活,追求与梦想</description>
	<lastBuildDate>Mon, 19 Jul 2010 05:09:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>IE8 hover&amp;opacity bug</title>
		<link>http://www.yigle.net/2009/08/ie8-hoveropacity-bug.html</link>
		<comments>http://www.yigle.net/2009/08/ie8-hoveropacity-bug.html#comments</comments>
		<pubDate>Tue, 25 Aug 2009 18:17:46 +0000</pubDate>
		<dc:creator>rong179</dc:creator>
				<category><![CDATA[Css]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[hover]]></category>
		<category><![CDATA[IE8]]></category>
		<category><![CDATA[opacity]]></category>

		<guid isPermaLink="false">http://www.yegle.cn/?p=35975</guid>
		<description><![CDATA[今天改网页时遇到的问题：

ul{width:206px;filter:alpha(opacity=80);border:1px solid #000; }
li{height:20px;line-height:20px;}
]]></description>
			<content:encoded><![CDATA[<p><code>今天改网页时遇到的问题：</code></p>
<p><code><br />
ul{width:206px;filter:alpha(opacity=80);border:1px solid #000; }<br />
li{height:20px;line-height:20px;}<br />
li:hover{background-color:#CCC;}<br />
a{color:#666;}<br />
&lt;ul&gt;<br />
&lt;li&gt;&lt;a href="#"&gt;dsfsadfsdfsd&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href="#"&gt;dsfsadfsdfsd&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href="#"&gt;dsfsadfsdfsd&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href="#"&gt;dsfsadfsdfsd&lt;/a&gt;&lt;/li&gt;<br />
&lt;/ul&gt;</code></p>
<p><a href="http://dl.getdropbox.com/u/1405911/yeglecn/post/ie8-hover-opacity.html">示例网页</a></p>
<p>当hover元素父级、爷级&#8230;设置透明度时，hover元素浏览变的很卡，而且经过元素时还可能不改变背景色。</p>
<p>原来我以为是js编写影响效率的问题，后来精简代码发现IE8这个lj</p>
<p>我尝试让li获得layout不过行不通，但当用position:relative;时似乎修复bug了，不过透明度又没了。。。</p>
<p><a href="http://dl.getdropbox.com/u/1405911/yeglecn/post/ie8-hover-opacity-hack.html">示例网页</a></p>
<p>不知道有没有好办法解决？<span style="text-decoration: line-through;">最后还是决定去除opacity，改用背景透明图片，毕竟ie 滤镜不是个省事的东西</span>，考虑兼容性及加载问题，改用JS实现over效果，</p>
<h3  class="related_post_title">也许你会喜欢</h3><ul class="related_post"><li><a href="http://www.yigle.net/2009/04/blogbus-cmt.html" title="blogbus Cmt博客大巴评论插件">blogbus Cmt博客大巴评论插件</a> (93)</li><li><a href="http://www.yigle.net/2009/04/what-is-gravatar.html" title="什么是Gravatar？">什么是Gravatar？</a> (12)</li><li><a href="http://www.yigle.net/2008/11/blogbus_gravata.html" title="让blogbus支持Gravatar">让blogbus支持Gravatar</a> (10)</li><li><a href="http://www.yigle.net/2009/06/%e4%b8%80%e4%b8%aa%e5%9f%9f%e5%90%8d%ef%bc%8c%e4%b8%80%e4%b8%aa%e4%ba%92%e8%81%94%e7%bd%91%e7%9a%84id.html" title="一个域名，一个互联网的ID">一个域名，一个互联网的ID</a> (8)</li><li><a href="http://www.yigle.net/2009/08/mo-radio.html" title="Mo Radio">Mo Radio</a> (4)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.yigle.net/2009/08/ie8-hoveropacity-bug.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>当position:relative遇到overflow:auto</title>
		<link>http://www.yigle.net/2008/11/e5-bd-93positionrelative-e9-81-87-e5-88-b0overflowauto.html</link>
		<comments>http://www.yigle.net/2008/11/e5-bd-93positionrelative-e9-81-87-e5-88-b0overflowauto.html#comments</comments>
		<pubDate>Sun, 23 Nov 2008 02:57:20 +0000</pubDate>
		<dc:creator>rong179</dc:creator>
				<category><![CDATA[Css]]></category>
		<category><![CDATA[fixed]]></category>
		<category><![CDATA[IEbug]]></category>
		<category><![CDATA[overflow:auto]]></category>
		<category><![CDATA[position:relative]]></category>

		<guid isPermaLink="false">http://yegle.yo2.cn/articles/%e5%bd%93positionrelative%e9%81%87%e5%88%b0overflowauto.html</guid>
		<description><![CDATA[IE7/6bug:在non-quirks 模式下设置position:relative;的元素A当被一带有overflow:auto/scroll属性的块级元素包含时,表现出postion:fixed的特性：
	滚动包含块的滚动条，A
	元素固定不动；当包含块不足以包含A时，A会
	超出包含块外。
<br /><br />
测试页面<br /><br />
解决方法：很简单,为包含块添加属性，position:relative,这种方法似乎很完美，因为不会产生什么附加效果，不过当包含块不...]]></description>
			<content:encoded><![CDATA[<p><font size="6" color="#999999">IE7/6</font>bug:</p>
<p>&nbsp;&nbsp;&nbsp; 在<a href="http://www.yegle.cn/logs/31654600.html" target="_blank">non-quirks </a>模式下设置position:relative;的元素<strong>A</strong>当被一带有overflow:auto/scroll属性的块级元素包含时,表现出postion:fixed的特性：<br />
	滚动包含块的滚动条，A<br />
	元素固定不动；当包含块不足以包含A时，A会<br />
	超出包含块外。
</p>
<p><img src="http://dl.getdropbox.com/u/296212/yegle/post/pic/overflowAndrelative1.png" alt="预览效果" width="300" /></p>
<p><a href="http://dl.getdropbox.com/u/296212/yegle/post/overflow%26relative.html" target="_blank">测试页面</a></p>
<p>解决方法：很简单,为包含块添加属性，<strong>position:relative</strong>,<a href="http://dl.getdropbox.com/u/296212/yegle/post/overflow&amp;relative2.html" target="_blank" title="IE6/7下打开">解决页面</a>.</p>
<p>这种方法似乎很完美，因为不会产生什么附加效果，不过当包含块不希望设置这一属性时就麻烦了，比如在IE6中模拟position:fixed时。</p>
<h3  class="related_post_title">也许你会喜欢</h3><ul class="related_post"><li><a href="http://www.yigle.net/2009/04/blogbus-cmt.html" title="blogbus Cmt博客大巴评论插件">blogbus Cmt博客大巴评论插件</a> (93)</li><li><a href="http://www.yigle.net/2009/04/what-is-gravatar.html" title="什么是Gravatar？">什么是Gravatar？</a> (12)</li><li><a href="http://www.yigle.net/2008/11/blogbus_gravata.html" title="让blogbus支持Gravatar">让blogbus支持Gravatar</a> (10)</li><li><a href="http://www.yigle.net/2009/06/%e4%b8%80%e4%b8%aa%e5%9f%9f%e5%90%8d%ef%bc%8c%e4%b8%80%e4%b8%aa%e4%ba%92%e8%81%94%e7%bd%91%e7%9a%84id.html" title="一个域名，一个互联网的ID">一个域名，一个互联网的ID</a> (8)</li><li><a href="http://www.yigle.net/2009/08/mo-radio.html" title="Mo Radio">Mo Radio</a> (4)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.yigle.net/2008/11/e5-bd-93positionrelative-e9-81-87-e5-88-b0overflowauto.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Activating Browser Modes with Doctype</title>
		<link>http://www.yigle.net/2008/11/activating-browser-modes-with-doctype.html</link>
		<comments>http://www.yigle.net/2008/11/activating-browser-modes-with-doctype.html#comments</comments>
		<pubDate>Sun, 23 Nov 2008 01:59:47 +0000</pubDate>
		<dc:creator>rong179</dc:creator>
				<category><![CDATA[Css]]></category>
		<category><![CDATA[AlmostStandardsMode]]></category>
		<category><![CDATA[QuirksMode]]></category>
		<category><![CDATA[StandardsMode]]></category>
		<category><![CDATA[运行模式]]></category>

		<guid isPermaLink="false">http://yegle.yo2.cn/articles/activating-browser-modes-with-doctype.html</guid>
		<description><![CDATA[&#160;1.Standards mode

	&#60;!DOCTYPE html PUBLIC &#34;-//W3C//DTD XHTML 1.0 Strict//EN&#34; &#34;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&#34;&#62;<br />	&#60;!DOCTYPE html PUBLIC &#34;-//W3C//DTD XHTML 1.0 Transitional//EN&#34; &#34;h...]]></description>
			<content:encoded><![CDATA[<p>&nbsp;<font size="4"><a href="http://hsivonen.iki.fi/doctype/" target="_blank">Activating Browser Modes with Doctype</a></font></p>
<p><strong>1.</strong>Standards mode</p>
<p>&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;<br />	&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt; 
	</p>
<p> <strong>2.</strong>XML declaration makes IE 6 (but not IE 7!) trigger the Quirks mode.</p>
<p>可以通过临时向页中添加以下客户端脚本（该脚本在最新版本的 Internet Explorer、Firefox 和 Opera   中有效）确定浏览器的当前呈现模式。</p>
<p>&lt;script type=&quot;text/javascript&quot;&gt; alert( document.compatMode ); &lt;/script&gt;</p>
<h3  class="related_post_title">也许你会喜欢</h3><ul class="related_post"><li><a href="http://www.yigle.net/2009/04/blogbus-cmt.html" title="blogbus Cmt博客大巴评论插件">blogbus Cmt博客大巴评论插件</a> (93)</li><li><a href="http://www.yigle.net/2009/04/what-is-gravatar.html" title="什么是Gravatar？">什么是Gravatar？</a> (12)</li><li><a href="http://www.yigle.net/2008/11/blogbus_gravata.html" title="让blogbus支持Gravatar">让blogbus支持Gravatar</a> (10)</li><li><a href="http://www.yigle.net/2009/06/%e4%b8%80%e4%b8%aa%e5%9f%9f%e5%90%8d%ef%bc%8c%e4%b8%80%e4%b8%aa%e4%ba%92%e8%81%94%e7%bd%91%e7%9a%84id.html" title="一个域名，一个互联网的ID">一个域名，一个互联网的ID</a> (8)</li><li><a href="http://www.yigle.net/2009/08/mo-radio.html" title="Mo Radio">Mo Radio</a> (4)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.yigle.net/2008/11/activating-browser-modes-with-doctype.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Css Hack</title>
		<link>http://www.yigle.net/2008/11/css-hacks-feedback.html</link>
		<comments>http://www.yigle.net/2008/11/css-hacks-feedback.html#comments</comments>
		<pubDate>Sat, 22 Nov 2008 20:49:50 +0000</pubDate>
		<dc:creator>rong179</dc:creator>
				<category><![CDATA[Css]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[参考]]></category>

		<guid isPermaLink="false">http://yegle.yo2.cn/articles/%e5%87%a0%e4%b8%aa%e5%b8%b8%e7%94%a8hack.html</guid>
		<description><![CDATA[查看 Css Hack&#62;&#62;
请在下方反馈错误，或者提交新Hack信息
也许你会喜欢php curl详解 (0)css hack若干文章 (0)
]]></description>
			<content:encoded><![CDATA[<p><strong><a href="/demo/css-hacks.html" target="_blank">查看 Css Hack&gt;&gt;</a></strong><br />
请在下方反馈错误，或者提交新Hack信息</p>
<h3  class="related_post_title">也许你会喜欢</h3><ul class="related_post"><li><a href="http://www.yigle.net/2009/11/php-curl.html" title="php curl详解">php curl详解</a> (0)</li><li><a href="http://www.yigle.net/2008/07/css-hack-e8-8b-a5-e5-b9-b2-e6-96-87-e7-ab-a0.html" title="css hack若干文章">css hack若干文章</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.yigle.net/2008/11/css-hacks-feedback.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>web标准常见问题整理</title>
		<link>http://www.yigle.net/2008/11/web-standard-questions-finishing.html</link>
		<comments>http://www.yigle.net/2008/11/web-standard-questions-finishing.html#comments</comments>
		<pubDate>Sat, 15 Nov 2008 10:41:53 +0000</pubDate>
		<dc:creator>rong179</dc:creator>
				<category><![CDATA[Css]]></category>
		<category><![CDATA[css问题]]></category>
		<category><![CDATA[haslayout]]></category>

		<guid isPermaLink="false">http://yegle.yo2.cn/articles/web%e6%a0%87%e5%87%86%e5%b8%b8%e8%a7%81%e9%97%ae%e9%a2%98%e6%95%b4%e7%90%86.html</guid>
		<description><![CDATA[1.相对定位，在改变窗口大小时错位，让body也相对定位！<br /><br />2.overflow不管用？has layout （float）<br /><br />3.margin 重叠？]]></description>
			<content:encoded><![CDATA[<p>遇到问题集合，不断更新。。。</p>
<p>1.相对定位，在改变窗口大小时错位，<strong>让body也相对定位！</strong></p>
<p>2.IE6，overflow不管用？<a href="http://www.yegle.cn/logs/24782400.html" target="_blank"><strong>has layout （float）</strong></a></p>
<p>3.margin 重叠？</p>
<p>5.图片下方有空隙 。</p>
<p style="text-align: left;">设置img 为display:block，或者定义vertical-align属性值，<br />
还可以设置父容器的字体大小为零（！opera）.</p>
<p style="text-align: left;">另外可尝试下line-height ：100%；<span style="color: #c0c0c0;">Add 2008-11-28</span></p>
<p>6. IE6 绝对定位元素，相对其contexting box 不正确？<strong><a href="http://www.yegle.cn/logs/24782400.html#cb" target="_blank">has layout</a></strong> <span style="color: #c0c0c0;">2008-11-27</span></p>
<p>7.inline-block for ff2-:-moz-inline-stack and -moz-inline-box</p>
<p>http://www.planabc.net/2007/03/11/display_inline-block/</p>
<p>http://www.thismuchiknow.co.uk/?p=7</p>
<p>8.min-height for IE 6;iE6下设置height即可，因为高度会被撑开。<span style="color: #c0c0c0;">2008-11-27</span></p>
<h3  class="related_post_title">也许你会喜欢</h3><ul class="related_post"><li><a href="http://www.yigle.net/2009/04/blogbus-cmt.html" title="blogbus Cmt博客大巴评论插件">blogbus Cmt博客大巴评论插件</a> (93)</li><li><a href="http://www.yigle.net/2009/04/what-is-gravatar.html" title="什么是Gravatar？">什么是Gravatar？</a> (12)</li><li><a href="http://www.yigle.net/2008/11/blogbus_gravata.html" title="让blogbus支持Gravatar">让blogbus支持Gravatar</a> (10)</li><li><a href="http://www.yigle.net/2009/06/%e4%b8%80%e4%b8%aa%e5%9f%9f%e5%90%8d%ef%bc%8c%e4%b8%80%e4%b8%aa%e4%ba%92%e8%81%94%e7%bd%91%e7%9a%84id.html" title="一个域名，一个互联网的ID">一个域名，一个互联网的ID</a> (8)</li><li><a href="http://www.yigle.net/2009/08/mo-radio.html" title="Mo Radio">Mo Radio</a> (4)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.yigle.net/2008/11/web-standard-questions-finishing.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>line-height IE中的一点问题</title>
		<link>http://www.yigle.net/2008/10/line-height-ie-e4-b8-ad-e7-9a-84-e4-b8-80-e7-82-b9-e9-97-ae-e9-a2-98.html</link>
		<comments>http://www.yigle.net/2008/10/line-height-ie-e4-b8-ad-e7-9a-84-e4-b8-80-e7-82-b9-e9-97-ae-e9-a2-98.html#comments</comments>
		<pubDate>Wed, 29 Oct 2008 05:39:55 +0000</pubDate>
		<dc:creator>rong179</dc:creator>
				<category><![CDATA[Css]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[line-height]]></category>
		<category><![CDATA[垂直居中]]></category>

		<guid isPermaLink="false">http://yegle.yo2.cn/articles/line-height-ie%e4%b8%ad%e7%9a%84%e4%b8%80%e7%82%b9%e9%97%ae%e9%a2%98.html</guid>
		<description><![CDATA[对于单行元素设置垂直居中，我们经常通过将line-height设置成和其父级元素相同大小来实现。<br /><br />
但当单行元素设置浮动时，在ie中似乎有点小问题<br /><br />
问题一：
&#60;html&#62;<br />
 &#60;body&#62; <br />
 &#60;style type=&#34;text/css&#34;&#62;<br />
 body{font-size:14px;}<br />
 ul{overflow:hidden;height:...]]></description>
			<content:encoded><![CDATA[<p>对于单行元素设置垂直居中，我们经常通过将line-height设置成和其父级元素相同大小来实现。</p>
<p>但当单行元素设置浮动时，在ie中似乎有点小问题</p>
<h3>问题一：</h3>
<p><code>&lt;html&gt;<br />
 &lt;body&gt; <br />
 &lt;style type=&quot;text/css&quot;&gt;<br />
 body{font-size:14px;}<br />
 ul{overflow:hidden;height:24px;border:1px solid #ccc;line-height:24px;}<br />
 li{list-style:none;float:left;}/*去掉float再试一下*/<br />
 &lt;/style&gt;<br />
 &lt;body&gt;<br />
 &lt;ul&gt;<br />
 &lt;li&gt;校长在线&lt;/li&gt;<br />
 &lt;/ul&gt;<br />
 &lt;/body&gt;<br />
 &lt;/html&gt; </code></p>
<p>就可以看到当设置float时，在ie中元素有1px的偏下 。暂且可以通过设置*margin-top:1px;解决。</p>
<h3>问题二：</h3>
<p><code>&lt;html&gt;<br />
 &lt;body&gt; <br />
 &lt;style type=&quot;text/css&quot;&gt;<br />
 body{font-size:14px;}<br />
 ul{overflow:hidden;height:24px;border:1px solid #ccc;line-height:14px;}<br />
 li{list-style:none;float:left;}/*去掉float再试一下*/<br />
 &lt;/style&gt;<br />
 &lt;body&gt;<br />
 &lt;ul&gt;<br />
 &lt;li&gt;校长在线&lt;/li&gt;<br />
 &lt;/ul&gt;<br />
 &lt;/body&gt;<br />
 &lt;/html&gt; </code></p>
<p>可以看到&ldquo;校长在线&rdquo;上部也有1px的隐藏，可以通过vertial-align:bottom;解决。</p>
<p>原来认为上面的两个问题有什么联系，可实验了一下，似乎并没什么联系。当line-height,和字高相等时就会出现第二个问题，当line-height大于字高时第二个问题就不存在了。 </p>
<h3  class="related_post_title">也许你会喜欢</h3><ul class="related_post"><li><a href="http://www.yigle.net/2008/07/ie%e5%bf%ab%e6%8d%b7%e9%94%ae%e6%95%b4%e7%90%86.html" title="ie快捷键整理">ie快捷键整理</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.yigle.net/2008/10/line-height-ie-e4-b8-ad-e7-9a-84-e4-b8-80-e7-82-b9-e9-97-ae-e9-a2-98.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>类目之间竖线添加的方法</title>
		<link>http://www.yigle.net/2008/10/e7-b1-bb-e7-9b-ae-e4-b9-8b-e9-97-b4-e7-ab-96-e7-ba-bf-e6-b7-bb-e5-8a-a0-e7-9a-84-e6-96-b9-e6-b3-95.html</link>
		<comments>http://www.yigle.net/2008/10/e7-b1-bb-e7-9b-ae-e4-b9-8b-e9-97-b4-e7-ab-96-e7-ba-bf-e6-b7-bb-e5-8a-a0-e7-9a-84-e6-96-b9-e6-b3-95.html#comments</comments>
		<pubDate>Tue, 28 Oct 2008 05:44:56 +0000</pubDate>
		<dc:creator>rong179</dc:creator>
				<category><![CDATA[Css]]></category>
		<category><![CDATA[竖线]]></category>

		<guid isPermaLink="false">http://yegle.yo2.cn/articles/%e7%b1%bb%e7%9b%ae%e4%b9%8b%e9%97%b4%e7%ab%96%e7%ba%bf%e6%b7%bb%e5%8a%a0%e7%9a%84%e6%96%b9%e6%b3%95.html</guid>
		<description><![CDATA[<br />原以为类目之间的竖线添加无非三种方法：<br /><br />1、背景图<br />
在a标签设置一个padding 用宽1px高不等的背景图来position到右侧。<br />
缺点：最后一个还是要用class来隐藏掉背景。<br /><br />
2、符号<br />
在每个a标签之间用&#8221;&#124;&#8221;符号来填充。<br />
缺点：html文件变大，文件维护变得很麻烦，而且在html中毫无意义。<br /><br />
3、a标签...]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.bababian.com/phoinfo/B000131513EFDBE884DB1078DD7FE2F3DT" target="_blank"><img style="border: medium none " src="http://photo1.bababian.com/upload13/20081027/B000131513EFDBE884DB1078DD7FE2F3.jpg" alt="" /></a></p>
<p>&nbsp;原以为类目之间的竖线添加无非三种方法：</p>
<p>1、背景图<br />
在a标签设置一个padding 用宽1px高不等的背景图来position到右侧。<br />
缺点：最后一个还是要用class来隐藏掉背景。</p>
<p>2、符号<br />
在每个a标签之间用&rdquo;|&rdquo;符号来填充。<br />
缺点：html文件变大，文件维护变得很麻烦，而且在html中毫无意义。</p>
<p>3、a标签右侧的boder。<br />
同背景图一样，只不过使用border-right来代替。缺点也同上。</p>
<p>在淘宝首页看到的方法：</p>
<p><span style="text-decoration: underline">利用ul的overflow:hidden 再将li的margin-left:-1px实现</span>。这样的做法就可以同时避免以上的缺点了。注意，li的line-height要和字高相等。</p>
<h3  class="related_post_title">也许你会喜欢</h3><ul class="related_post"><li><a href="http://www.yigle.net/2009/04/blogbus-cmt.html" title="blogbus Cmt博客大巴评论插件">blogbus Cmt博客大巴评论插件</a> (93)</li><li><a href="http://www.yigle.net/2009/04/what-is-gravatar.html" title="什么是Gravatar？">什么是Gravatar？</a> (12)</li><li><a href="http://www.yigle.net/2008/11/blogbus_gravata.html" title="让blogbus支持Gravatar">让blogbus支持Gravatar</a> (10)</li><li><a href="http://www.yigle.net/2009/06/%e4%b8%80%e4%b8%aa%e5%9f%9f%e5%90%8d%ef%bc%8c%e4%b8%80%e4%b8%aa%e4%ba%92%e8%81%94%e7%bd%91%e7%9a%84id.html" title="一个域名，一个互联网的ID">一个域名，一个互联网的ID</a> (8)</li><li><a href="http://www.yigle.net/2009/08/mo-radio.html" title="Mo Radio">Mo Radio</a> (4)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.yigle.net/2008/10/e7-b1-bb-e7-9b-ae-e4-b9-8b-e9-97-b4-e7-ab-96-e7-ba-bf-e6-b7-bb-e5-8a-a0-e7-9a-84-e6-96-b9-e6-b3-95.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>css选择符</title>
		<link>http://www.yigle.net/2008/10/css-e9-80-89-e6-8b-a9-e7-ac-a6.html</link>
		<comments>http://www.yigle.net/2008/10/css-e9-80-89-e6-8b-a9-e7-ac-a6.html#comments</comments>
		<pubDate>Sat, 18 Oct 2008 02:43:28 +0000</pubDate>
		<dc:creator>rong179</dc:creator>
				<category><![CDATA[Css]]></category>
		<category><![CDATA[优先级]]></category>

		<guid isPermaLink="false">http://yegle.yo2.cn/articles/css%e9%80%89%e6%8b%a9%e7%ac%a6.html</guid>
		<description><![CDATA[<a href="http://rong179.kadoo.com/docs/files/pages/Selectors.html?ts=1224252517000" target="_blank" title="css选择符">css选择符参考</a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://rong179.kadoo.com/docs/files/pages/Selectors.html?ts=1224252517000" target="_blank" title="css选择符">css选择符参考</a></p>
<h3  class="related_post_title">也许你会喜欢</h3><ul class="related_post"><li><a href="http://www.yigle.net/2009/04/blogbus-cmt.html" title="blogbus Cmt博客大巴评论插件">blogbus Cmt博客大巴评论插件</a> (93)</li><li><a href="http://www.yigle.net/2009/04/what-is-gravatar.html" title="什么是Gravatar？">什么是Gravatar？</a> (12)</li><li><a href="http://www.yigle.net/2008/11/blogbus_gravata.html" title="让blogbus支持Gravatar">让blogbus支持Gravatar</a> (10)</li><li><a href="http://www.yigle.net/2009/06/%e4%b8%80%e4%b8%aa%e5%9f%9f%e5%90%8d%ef%bc%8c%e4%b8%80%e4%b8%aa%e4%ba%92%e8%81%94%e7%bd%91%e7%9a%84id.html" title="一个域名，一个互联网的ID">一个域名，一个互联网的ID</a> (8)</li><li><a href="http://www.yigle.net/2009/08/mo-radio.html" title="Mo Radio">Mo Radio</a> (4)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.yigle.net/2008/10/css-e9-80-89-e6-8b-a9-e7-ac-a6.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS优先级问题</title>
		<link>http://www.yigle.net/2008/10/css-e4-bc-98-e5-85-88-e7-ba-a7-e9-97-ae-e9-a2-98.html</link>
		<comments>http://www.yigle.net/2008/10/css-e4-bc-98-e5-85-88-e7-ba-a7-e9-97-ae-e9-a2-98.html#comments</comments>
		<pubDate>Fri, 17 Oct 2008 00:16:03 +0000</pubDate>
		<dc:creator>rong179</dc:creator>
				<category><![CDATA[Css]]></category>

		<guid isPermaLink="false">http://yegle.yo2.cn/articles/css%e4%bc%98%e5%85%88%e7%ba%a7%e9%97%ae%e9%a2%98.html</guid>
		<description><![CDATA[首先就是CSS规则的specificity（特殊性），CSS2.1有一套关于specificity的计算方式，用一个四位的数字串(CSS2是三位)来表示，最终以计算出来的值决定。<br />
关于specificity的具体计算在各种情况下的数字加成，形式是 0,0,0,0<br />

 <br />
 直接写在标签上的样式优先级为1,0,0,0<br />
  例如像这样的样式&#60;div style=&#34;font-size:2em&#34;&#62;标签&#60;/div&#38;g...]]></description>
			<content:encoded><![CDATA[<p class="copy">&nbsp;参考自：《Web标准设计》作者：aoao（略有改动）<br />
论坛讨论：<a href="http://bbs.blueidea.com/thread-2816822-1-1.html" target="_blank">http://bbs.blueidea.com/thread-2816822-1-1.html</a></p>
<p>首先就是CSS规则的specificity（特殊性），CSS2.1有一套关于specificity的计算方式，用一个四位的数字串(CSS2是三位)来表示，最终以计算出来的值决定。<br />
关于specificity的具体计算在各种情况下的数字加成，形式是 0,0,0,0
</p>
<ul>
 </p>
<li>直接写在标签上的样式优先级为1,0,0,0<br />
  例如像这样的样式&lt;div style=&quot;font-size:2em&quot;&gt;标签&lt;/div&gt;</li>
<li>每个ID选择符(#someid)，加 0,1,0,0<br />
  为什么说每个呢？如果像这样的选择符#selAbout #nav{ &hellip;}　就是0,2,0,0了。</li>
<li>每个class选择符(.someclass)、每个属性选择符(形如[attr=&quot;&quot;]等)、每个伪类(形如:hover等)加0,0,1,0</li>
<li>每个元素或伪元素(:firstchild)等，加0,0,0,1</li>
<li>其他选择符包括全局选择符*，加0,0,0,0。</li>
</ul>
<p>
按这些规则将数字串逐位相加，就得到最终计算得的specificity，然后在比较取舍时按照从左到右的顺序逐位比较，例如：</p>
<p> <code>&lt;style type=&quot;text/css&quot; media=&quot;all&quot;&gt;<br />
  *{color:yellow}<br />
  h1 {color: red;}<br />
  /* 只有一个普通元素加成，结果是 0,0,0,1 */<br />
  body h1 {color: green;}<br />
  /* 两个普通元素加成，结果是 0,0,0,2 */<br />
  /* 后者胜出 */<br />
  h1.grape {color: purple;}<br />
  /* 一个普通元素、一个class选择符加成，结果是 0,0,1,1*/<br />
  h1#answer {color: navy;}<br />
  /* 一个ID选择符，一个普通选择符，结果是0,1,0,1 */<br />
  /* 后者胜出 */<br />
  &lt;/style&gt;<br />
  <br />
 &lt;body&gt;<br />
 &lt;h1 class=&quot;grape&quot; id=&quot;answer&quot;&gt;csssssssssssssss&lt;/h1&gt;<br />
 &lt;/body&gt;</code></p>
<p>除了这个specificity外，还有一些影响的因素：</p>
<ul>
<li>有!important声明的规则高于一切。</li>
<li>如果!important声明冲突，则比较优先权。</li>
<li>如果优先权一样，则按照在源码中出现的顺序决定，后来者居上。</li>
<li>由继承而得到的样式没有specificity的计算，它低于一切其他规则(比如全局选择符*定义的规则)。</li>
<li>关于由@import载入的外部样式，由于@import必须出现在所有其他规则定义之前(如不是，则浏览器应该忽略之)，所以按照后来居上原则，一般优先权冲突时是占下风的。这里需要提一下IE，IE是可以识别位置错误的@import的，但无论@import在什么地方，它都认为是位于所有其他规则定义之前的，这可能会引发一些误会。</li>
</ul>
<h3  class="related_post_title">也许你会喜欢</h3><ul class="related_post"><li><a href="http://www.yigle.net/2009/04/blogbus-cmt.html" title="blogbus Cmt博客大巴评论插件">blogbus Cmt博客大巴评论插件</a> (93)</li><li><a href="http://www.yigle.net/2009/04/what-is-gravatar.html" title="什么是Gravatar？">什么是Gravatar？</a> (12)</li><li><a href="http://www.yigle.net/2008/11/blogbus_gravata.html" title="让blogbus支持Gravatar">让blogbus支持Gravatar</a> (10)</li><li><a href="http://www.yigle.net/2009/06/%e4%b8%80%e4%b8%aa%e5%9f%9f%e5%90%8d%ef%bc%8c%e4%b8%80%e4%b8%aa%e4%ba%92%e8%81%94%e7%bd%91%e7%9a%84id.html" title="一个域名，一个互联网的ID">一个域名，一个互联网的ID</a> (8)</li><li><a href="http://www.yigle.net/2009/08/mo-radio.html" title="Mo Radio">Mo Radio</a> (4)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.yigle.net/2008/10/css-e4-bc-98-e5-85-88-e7-ba-a7-e9-97-ae-e9-a2-98.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>(X)HTML Strict 下的嵌套规则</title>
		<link>http://www.yigle.net/2008/09/xhtml-strict-e4-b8-8b-e7-9a-84-e5-b5-8c-e5-a5-97-e8-a7-84-e5-88-99.html</link>
		<comments>http://www.yigle.net/2008/09/xhtml-strict-e4-b8-8b-e7-9a-84-e5-b5-8c-e5-a5-97-e8-a7-84-e5-88-99.html#comments</comments>
		<pubDate>Mon, 29 Sep 2008 06:58:14 +0000</pubDate>
		<dc:creator>rong179</dc:creator>
				<category><![CDATA[Css]]></category>
		<category><![CDATA[web标准]]></category>
		<category><![CDATA[嵌套规则]]></category>

		<guid isPermaLink="false">http://yegle.yo2.cn/articles/xhtml-strict-%e4%b8%8b%e7%9a%84%e5%b5%8c%e5%a5%97%e8%a7%84%e5%88%99.html</guid>
		<description><![CDATA[<p>下面是一份在 HTML 4 Strict 和 XHTML 1.0 Strict 下必须遵守的标签嵌套规则，比如你不能在 <code>&#60;a&#62;</code> 里面再嵌入一个 <code>&#60;a&#62;</code> 这样的约定。</p>

<p><strong>说明：</strong></p>


<ul><li>为了方便读者阅读，本文中的标签使用了大写（根据 XHTML 的规则，元素名必须小写，比如 <code>&#60;html&#62;</code> 而不应是 <code>&#60;HTML&#62;</code>）
</li><li>小写的单词表明一组或一系列 HTML 标签</li><li>每一项条目（标签）后都跟随一组标签列表，如果没有这个列表，那么表明该条目（标签）内部不允许包含任何标签。这意味着该条目内部只能包含纯文本
内容（#PCDATA，见下文）。如果注明 (empty)，这意味着该条目内部不允许包含任何形式的内容。对于
flow，inline，block，OBJECT 和 BODY，其内部允许包含的内容在文中会单独给出。
</li><li><a href="http://www.webreference.com/dlab/books/html/3-5.html#3-5-2-2">#PCDATA</a> 的意思是&#8220;parsed character data&#8221;，即纯文本内容（不包括任何 HTML 标签，但是转义内容可以存在，比如 <code>&#38;auml;</code> 和 <code>&#38;#228;</code>）</li><li>CDATA 的意思是&#8220;character data&#8221;，这意味着不包括转义内容的纯文本内容，详细内容可以参考<a href="http://www.flightlab.com/%7Ejoe/sgml/cdata.html">CDATA Confusion</a></li><li>excluding ... 意即不得直接或者间接的包含所列的元素<br />...</li></ul>]]></description>
			<content:encoded><![CDATA[<p class="copy">转自:<a href="http://www.junchenwu.com/2007/01/allowed_nesting_of_elements_in_html_4_strict_and_xhtml_10_strict.html" target="_blank">http://www.junchenwu.com/2007/01/allowed_nesting_of_elements_in_html_4_strict_and_xhtml_10_strict.html</a><br />作者：JunChen Wu</p>
<p>&nbsp;</p>
<div class="entrybody">
<p>&nbsp;</p>
<p>下面是一份在 HTML 4 Strict 和 XHTML 1.0 Strict 下必须遵守的标签嵌套规则，比如你不能在 &lt;a&gt; 里面再嵌入一个 &lt;a&gt; 这样的约定。</p>
<p><strong>说明：</strong></p>
<ul>
<li>为了方便读者阅读，本文中的标签使用了大写（根据 XHTML 的规则，元素名必须小写，比如 &lt;html&gt; 而不应是 &lt;HTML&gt;）
</li>
<li>小写的单词表明一组或一系列 HTML 标签
</li>
<li>每一项条目（标签）后都跟随一组标签列表，如果没有这个列表，那么表明该条目（标签）内部不允许包含任何标签。这意味着该条目内部只能包含纯文本<br />
内容（#PCDATA，见下文）。如果注明 (empty)，这意味着该条目内部不允许包含任何形式的内容。对于<br />
flow，inline，block，OBJECT 和 BODY，其内部允许包含的内容在文中会单独给出。</p>
</li>
<li><a href="http://www.webreference.com/dlab/books/html/3-5.html#3-5-2-2">#PCDATA</a> 的意思是&ldquo;parsed character data&rdquo;，即纯文本内容（不包括任何 HTML 标签，但是转义内容可以存在，比如 &amp;auml; 和 &amp;#228;）</li>
<li>CDATA 的意思是&ldquo;character data&rdquo;，这意味着不包括转义内容的纯文本内容，详细内容可以参考<a href="http://www.flightlab.com/%7Ejoe/sgml/cdata.html">CDATA Confusion</a></li>
<li>excluding &#8230; 意即不得直接或者间接的包含所列的元素</li>
</ul>
<p><img src="http://dl.getdropbox.com/u/296212/yegle/post/pic/qintaoguize.gif" alt="图：嵌套规则" width="550" /></p>
<p>注1. 以上内容基于 [HTML 4.01 Specification] 的 <a href="http://www.w3.org/TR/1999/REC-html401-19991224/sgml/dtd.html">Strict DTD</a>。<a href="http://www.junchenwu.com/">JunChen</a> 翻译自 <a href="http://www.cs.tut.fi/%7Ejkorpela/html/strict.html">Allowed nesting of elements in HTML 4 Strict (and XHTML 1.0 Strict)</a></p>
<p>注2. 对于 <a href="http://www.w3.org/TR/xhtml1/">XHTML 1.0</a>，基本上一致，不同点如下：</p>
<ul>
<li>对于 &lt;script&gt; 和 &lt;style&gt; 的内容，在 HTML 4 里是 CDATA 而在 XHTML 里是 #PCDATA</li>
<li>在 XHTML 中，&lt;table&gt; 标签后可以紧跟一个 &lt;tr&gt;，而在 HTML 4.01 里，不允许这样，不过 &lt;tbody&gt; 标签又是可以省略的。意思就是说，如果代码中的 &lt;table&gt; 后紧跟 &lt;tr&gt;，对于 HTML 4.01，会隐性的生成一个 &lt;tbody&gt; 标签，而在 XHTML 里面就没有。这会影响到样式表使用 tbody 作为选择器。</li>
</ul>
</div>
<h3  class="related_post_title">也许你会喜欢</h3><ul class="related_post"><li><a href="http://www.yigle.net/2008/07/e7-81-ab-e7-8b-90-e5-ae-9e-e7-8e-b0text-overflowellipsis-e6-95-88-e6-9e-9c.html" title="火狐实现text-overflow:ellipsis 效果">火狐实现text-overflow:ellipsis 效果</a> (0)</li><li><a href="http://www.yigle.net/2008/07/on-having-layout.html" title="On having layout">On having layout</a> (0)</li><li><a href="http://www.yigle.net/2008/07/%e5%85%b3%e4%ba%8e%e6%96%87%e6%a1%a3%e8%b7%af%e5%be%84.html" title="关于文档路径">关于文档路径</a> (0)</li><li><a href="http://www.yigle.net/2008/07/%e5%87%a0%e4%bb%bdweb%e6%a0%87%e5%87%86head.html" title="几份web标准head">几份web标准head</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.yigle.net/2008/09/xhtml-strict-e4-b8-8b-e7-9a-84-e5-b5-8c-e5-a5-97-e8-a7-84-e5-88-99.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
