<?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.artcss.com/archives/tag/css%e5%85%bc%e5%ae%b9/feed" rel="self" type="application/rss+xml" />
	<link>http://www.artcss.com</link>
	<description>一个像素的距离...</description>
	<lastBuildDate>Sat, 12 Feb 2011 03:34:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>探究IE6的几个奇怪的问题（一）</title>
		<link>http://www.artcss.com/archives/232.html</link>
		<comments>http://www.artcss.com/archives/232.html#comments</comments>
		<pubDate>Thu, 24 Sep 2009 15:49:23 +0000</pubDate>
		<dc:creator>Artcss</dc:creator>
				<category><![CDATA[个人随笔]]></category>
		<category><![CDATA[css兼容]]></category>
		<category><![CDATA[IE6]]></category>
		<category><![CDATA[双倍padding]]></category>

		<guid isPermaLink="false">http://www.artskin.cn/blog/?p=232</guid>
		<description><![CDATA[前两天在做页面时发现了一个奇怪的问题，就是IE6在写列表时，如果给ul定了padding-top值以后，当li换到下一行时，ul上的padding-top值就会在第二行的li上生效，一开始我还以为在IE6中li继承了ul的padding之呢，但是不应该呀！ 可能文字表达不好，直接上例子和截图吧。 问题的出现： &#60;!DOCTYPE html PUBLIC &#34;-//W3C//DTD XHTML 1.0 Transitional//EN&#34; &#34;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#34;&#62; &#60;html xmlns=&#34;http://www.w3.org/1999/xhtml&#34;&#62; &#60;head&#62; &#60;meta http-equiv=&#34;Content-Type&#34; content=&#34;text/html; charset=utf-8&#34; /&#62; &#60;meta name=&#34;author&#34; content=&#34;artskin@163.com,guliqiang&#34; /&#62; &#60;meta name=&#34;Copyright&#34; content=&#34;版权所有未经授权 不得复制或建立镜像&#34; /&#62; &#60;meta name=&#34;Keywords&#34; content=&#34;前端思考&#34; /&#62; &#60;meta content=&#34;all&#34; name=&#34;robots&#34; /&#62; &#60;title&#62;浏览器兼容测试 &#124;&#124; 前端思考&#60;/title&#62; &#60;style&#62; &#60;!-- body,ul,li{margin:0;padding:0;} body{padding:10px;} li{list-style:none;color:#fff;font-size:50px;text-align:center;} .box{width:150px;height:180px;background:#ccc;} .box ul{padding-top:30px;} .box ul li{width:60px;height:60px;float:left;margin:10px 0 0 10px;background:#333;color:#fff;} --&#62; &#60;/style&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>前两天在做页面时发现了一个奇怪的问题，就是IE6在写列表时，如果给ul定了padding-top值以后，当li换到下一行时，ul上的padding-top值就会在第二行的li上生效，一开始我还以为在IE6中li继承了ul的padding之呢，但是不应该呀！</p>
<p>可能文字表达不好，直接上例子和截图吧。</p>
<h4>问题的<span id="more-232"></span>出现：</h4>
<div class="runcode">
<p><textarea name="runcode" class="runcode_text" id="runcode_Vo53d7">
&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;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
&lt;meta name=&quot;author&quot; content=&quot;artskin@163.com,guliqiang&quot; /&gt;
&lt;meta name=&quot;Copyright&quot; content=&quot;版权所有未经授权 不得复制或建立镜像&quot; /&gt;
&lt;meta name=&quot;Keywords&quot; content=&quot;前端思考&quot; /&gt;
&lt;meta content=&quot;all&quot; name=&quot;robots&quot; /&gt;
&lt;title&gt;浏览器兼容测试 || 前端思考&lt;/title&gt;
&lt;style&gt;
&lt;!--
body,ul,li{margin:0;padding:0;}
body{padding:10px;}
li{list-style:none;color:#fff;font-size:50px;text-align:center;}
.box{width:150px;height:180px;background:#ccc;}
.box ul{padding-top:30px;}
.box ul li{width:60px;height:60px;float:left;margin:10px 0 0 10px;background:#333;color:#fff;}
--&gt;
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div class=&quot;box&quot;&gt;
	&lt;ul&gt;
		&lt;li&gt;1&lt;/li&gt;
		&lt;li&gt;2&lt;/li&gt;
		&lt;li&gt;3&lt;/li&gt;
		&lt;li&gt;4&lt;/li&gt;
	&lt;/ul&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</textarea></p>
<p><input type="button" value="运行" class="runcode_button" onclick="runcode_open_new('runcode_Vo53d7');"/> <input type="button" value="复制" class="runcode_button" onclick="runcode_copy('runcode_Vo53d7');"/> 提示：你可以先修改部分代码再运行。</p>
</div>
<p>这段代码在Firefox3和IE8里边显示正常，是这样的：</p>
<p><a href="http://www.artskin.cn/blog/wp-content/uploads/2009/09/firefix.gif"><img src="http://www.artskin.cn/blog/wp-content/uploads/2009/09/firefix.gif" alt="firefix" title="firefix" width="236" height="203" class="alignnone size-full wp-image-233" /></a></p>
<p>但在IE6下边却是这样：</p>
<p><a href="http://www.artskin.cn/blog/wp-content/uploads/2009/09/ie6.gif"><img src="http://www.artskin.cn/blog/wp-content/uploads/2009/09/ie6.gif" alt="ie6" title="ie6" width="349" height="312" class="alignnone size-full wp-image-235" /></a></p>
<p>ie7不会撑开父级高度，这样显示：</p>
<p><a href="http://www.artskin.cn/blog/wp-content/uploads/2009/09/ie7.jpg"><img src="http://www.artskin.cn/blog/wp-content/uploads/2009/09/ie7.jpg" alt="ie7" title="ie7" width="323" height="344" class="alignnone size-full wp-image-241" /></a></p>
<p>经过多方打听，终于找到了解决方法，这里IE6的两个问题：</p>
<p>一、是双倍边距，这个大家都很熟悉，用display:inline就可以解决；</p>
<p>二、另一个padding-top是经一个网名叫“糖糖”的网友提醒，加了zoom:1解决的，应该是IE的hasLayout Bug</p>
<h4>下面是最佳解决方案：</h4>
<div class="runcode">
<p><textarea name="runcode" class="runcode_text" id="runcode_5B2hGX">
&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;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
&lt;meta name=&quot;author&quot; content=&quot;artskin@163.com,guliqiang&quot; /&gt;
&lt;meta name=&quot;Copyright&quot; content=&quot;版权所有未经授权 不得复制或建立镜像&quot; /&gt;
&lt;meta name=&quot;Keywords&quot; content=&quot;前端思考&quot; /&gt;
&lt;meta content=&quot;all&quot; name=&quot;robots&quot; /&gt;
&lt;title&gt;浏览器兼容测试 || 前端思考&lt;/title&gt;
&lt;style&gt;
&lt;!--
body,ul,li{margin:0;padding:0;}
body{padding:10px;}
li{list-style:none;color:#fff;font-size:50px;text-align:center;}
.box{width:150px;height:180px;background:#ccc;}
.box ul{padding-top:30px;zoom:1;}
.box ul li{width:60px;height:60px;float:left;margin:10px 0 0 10px;background:#333;color:#fff;display:inline;}
--&gt;
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div class=&quot;box&quot;&gt;
	&lt;ul&gt;
		&lt;li&gt;1&lt;/li&gt;
		&lt;li&gt;2&lt;/li&gt;
		&lt;li&gt;3&lt;/li&gt;
		&lt;li&gt;4&lt;/li&gt;
	&lt;/ul&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</textarea></p>
<p><input type="button" value="运行" class="runcode_button" onclick="runcode_open_new('runcode_5B2hGX');"/> <input type="button" value="复制" class="runcode_button" onclick="runcode_copy('runcode_5B2hGX');"/> 提示：你可以先修改部分代码再运行。</p>
</div>
<p>最后终于解决了，哈哈，大家也可以这样试试！</p>
]]></content:encoded>
			<wfw:commentRss>http://www.artcss.com/archives/232.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

