<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title><![CDATA[蜗爱CSS - Hack]]></title>
<link>http://www.woaicss.com/</link>
<description><![CDATA[css初学者 前端技术]]></description>
<language>zh-cn</language>
<copyright><![CDATA[Copyright 2005 PBlog3 v2.8]]></copyright>
<webMaster><![CDATA[wo-ai-niqq@163.com(蜗牛)]]></webMaster>
<generator>PBlog2 v2.4</generator> 
<image>
	<title>蜗爱CSS</title>
	<url>http://www.woaicss.com/images/logos.gif</url>
	<link>http://www.woaicss.com/</link>
	<description>蜗爱CSS</description>
</image>

			<item>
			<link>http://www.woaicss.com/article/hack/hackk.htm</link>
			<title><![CDATA[IE6兼容问题汇总]]></title>
			<author>wo-ai-niqq@163.com(woniu)</author>
			<category><![CDATA[Hack]]></category>
			<pubDate>Fri,11 Jun 2010 14:47:42 +0800</pubDate>
			<guid>http://www.woaicss.com/default.asp?id=198</guid>
		<description><![CDATA[1、终极方法：条件注释<br/><br/>&lt;!--[if lte IE 6]&gt; 这段文字仅显示在 IE6及IE6以下版本。 &lt;![endif]--&gt;<br/><br/>&lt;!--[if gte IE 6]&gt; 这段文字仅显示在 IE6及IE6以上版本。 &lt;![endif]--&gt;<br/><br/>&lt;!--[if gt IE 6]&gt; 这段文字仅显示在 IE6以上版本（不包含IE6）。 &lt;![endif]--&gt;<br/><br/>&lt;!--[if IE 5.5]&gt; 这段文字仅显示在 IE5.5。 &lt;![endif]--&gt;<br/><br/>&lt;!--在 IE6及IE6以下版本中加载css--&gt;<br/><br/>&lt;!--[if lte IE 6]&gt; &lt;link type=&#34;text/css&#34; rel=&#34;stylesheet&#34; href=&#34;css/ie6.css&#34; mce_href=&#34;css/ie6.css&#34; /&gt;&lt;![endif]--&gt;<br/>缺点是在IE浏览器下可能会增加额外的HTTP请求数。<br/><br/>2、CSS选择器区分<br/><br/>IE6不支持子选择器；先针对IE6使用常规申明CSS选择器，然后再用子选择器针对IE7+及其他浏览器。<br/><br/>/* IE6 专用 */<br/><br/>.content {color:red;}<br/><br/>/* 其他浏览器 */<br/><br/>div&gt;p .content {color:blue;} --&gt;<br/>3、PNG半透明图片的问题<br/><br/>虽然可以通过JS等方式解决，但依然存在载入速度等问题，所以，这个在设计上能避免还是尽量避免为好。以达到网站最大优化。<br/><br/>4、IE6下的圆角<br/><br/>IE6不支持CSS3的圆角属性，性价比最高的解决方法就是用图片圆角来替代，或者放弃IE6的圆角。<br/><br/>5、IE6背景闪烁<br/><br/>如果你给链接、按钮用CSS sprites作为背景，你可能会发现在IE6下会有背景图闪烁的现象。造成这个的原因是由于IE6没有将背景图缓存，每次触发hover的时候都会重新加载，可以用JavaScript设置IE6缓存这些图片：<br/><br/>document.execCommand(&#34;BackgroundImageCache&#34;,false,true);<br/>6、最小高度<br/><br/>IE6 不支持min-height属性，但它却认为height就是最小高度。解决方法：使用ie6不支持但其余浏览器支持的属性!important。<br/><br/>#container {min-height:200px; height:auto !important; height:200px;}<br/>7、最大高度<br/><br/>//直接使用ID来改变元素的最大高度<br/>var container = document.getElementById(&#39;container&#39;);<br/>container.style.height = (container.scrollHeight &gt; 199) ? &#34;200px&#34; : &#34;auto&#34;;<br/><br/>//写成函数来运行<br/>function setMaxHeight(elementId, height){<br/>var container = document.getElementById(elementId);<br/>container.style.height = (container.scrollHeight &gt; (height - 1)) ? height + &#34;px&#34; : &#34;auto&#34;;<br/>}<br/><br/>//函数示例<br/>setMaxHeight(&#39;container1&#39;, 200);<br/>setMaxHeight(&#39;container2&#39;, 500);<br/>8、100% 高度<br/><br/>在IE6下，如果要给元素定义100%高度，必须要明确定义它的父级元素的高度，如果你需要给元素定义满屏的高度，就得先给html和body定义height:100%;。<br/><br/>9、最小宽度<br/><br/>同max-height和max-width一样，IE6也不支持min-width。<br/><br/>//直接使用ID来改变元素的最小宽度<br/>var container = document.getElementById(&#39;container&#39;);<br/>container.style.width = (container.clientWidth &lt; width) ? &#34;500px&#34; : &#34;auto&#34;;<br/><br/>//写成函数来运行<br/>function setMinWidth(elementId, width){<br/>var container = document.getElementById(elementId);<br/>container.style.width = (container.clientWidth &lt; width) ? width + &#34;px&#34; : &#34;auto&#34;;<br/>}<br/><br/>//函数示例<br/>setMinWidth(&#39;container1&#39;, 200);<br/>setMinWidth(&#39;container2&#39;, 500);<br/>10、最大宽度<br/><br/>//直接使用ID来改变元素的最大宽度<br/>var container = document.getElementById(elementId);<br/>container.style.width = (container.clientWidth &gt; (width - 1)) ? width + &#34;px&#34; : &#34;auto&#34;;<br/><br/>//写成函数来运行<br/>function setMaxWidth(elementId, width){<br/>var container = document.getElementById(elementId);<br/>container.style.width = (container.clientWidth &gt; (width - 1)) ? width + &#34;px&#34; : &#34;auto&#34;;<br/>}<br/><br/>//函数示例<br/>setMaxWidth(&#39;container1&#39;, 200);<br/>setMaxWidth(&#39;container2&#39;, 500);<br/>11、双边距Bug<br/><br/>当元素浮动时，IE6会错误的把浮动方向的margin值双倍计算。个人觉得较好解决方法是避免float和margin同时使用。<br/><br/>12、清除浮动<br/><br/>如果你想用div(或其他容器)包裹一个浮动的元素，你会发现必须给div(容器)定义明确的height、width、overflow之中一个属性（除了auto值）才能将浮动元素严实地包裹。<br/><br/>#container {border:1px solid #333; overflow:auto; height:100%;}<br/>#floated1 {float:left; height:300px; width:200px; background:#00F;}<br/>#floated2 {float:right; height:400px; width:200px; background:#F0F;}<br/>更多：<a href="http://www.twinsenliang.net/skill/20090413.html" target="_blank" rel="external">http://www.twinsenliang.net/skill/20090413.html</a><br/><br/>13、浮动层错位<br/><br/>当内容超出外包容器定义的宽度时，在IE6中容器会忽视定义的width值，宽度会错误地随内容宽度增长而增长。<br/><br/>浮动层错位问题在IE6下没有真正让人满意的解决方法，虽然可以使用overflow:hidden;或overflow:scroll;来修正， 但hidden容易导致其他一些问题，scroll会破坏设计；JavaScript也没法很好地解决这个问题。所以建议是一定要在布局上避免这个问题发 生，使用一个固定的布局或者控制好内容的宽度（给内层加width）。<br/><br/>14、躲猫猫bug<br/><br/>在IE6和IE7下，躲猫猫bug是一个非常恼人的问题。一个撑破了容器的浮动元素，如果在他之后有不浮动的内容，并且有一些定义了:hover的链接，当鼠标移到那些链接上时，在IE6下就会触发躲猫猫。<br/><br/>解决方法很简单：<br/>1.在（那个未浮动的）内容之后添加一个&lt;span style=&#34;clear: both;&#34;&gt; &lt;/span&gt;<br/>2.触发包含了这些链接的容器的hasLayout，一个简单的方法就是给其定义height:1%;<br/><br/>15、绝对定位元素的1像素间距bug<br/><br/>IE6下的这个错误是由于进位处理误差造成（IE7已修复），当绝对定位元素的父元素高或宽为奇数时，bottom和right会产生错误。唯一的解决办法就是给父元素定义明确的高宽值，但对于液态布局没有完美的解决方法。<br/><br/>16、3像素间距bug<br/><br/>在IE6中，当文本(或无浮动元素)跟在一个浮动的元素之后，文本和这个浮动元素之间会多出3像素的间隔。<br/>给浮动层添加 display:inline 和 -3px 负值margin<br/>给中间的内容层定义 margin-right 以纠正-3px<br/><br/>17、IE下z-index的bug<br/><br/>在IE浏览器中，定位元素的z-index层级是相对于各自的父级容器，所以会导致z-index出现错误的表现。解决方法是给其父级元素定义z-index，有些情况下还需要定义position:relative。<br/><br/>18、Overflow Bug<br/><br/>在IE6/7中，overflow无法正确的隐藏有相对定位position:relative;的子元素。解决方法就是给外包容器.wrap加上position:relative;。<br/><br/>19、横向列表宽度bug<br/><br/>如果你使用float:left;把&lt;li&gt;横向摆列，并且&lt;li&gt;内包含的&lt;a&gt;（或其他）触发了 hasLayout，在IE6下就会有错误的表现。解决方法很简单，只需要给&lt;a&gt;定义同样的float:left;即可。<br/><br/>20、列表阶梯bug<br/><br/>列表阶梯bug通常会在给&lt;li&gt;的子元素&lt;a&gt;使用float:left;时触发，我们本意是要做一个横向的列表(通常 是导航栏)，但IE却可能呈现出垂直的或者阶梯状。解决办法就是给&lt;li&gt;定义float:left;而非子元素&lt;a&gt;，或者 给&lt;li&gt;定义display:inline;也可以解决。<br/><br/>21、垂直列表间隙bug<br/><br/>当我们使用&lt;li&gt; 包含一个块级子元素时，IE6(IE7也有可能)会错误地给每条列表元素（&lt;li&gt;）之间添加空隙。<br/><br/>解决方法：把&lt;a&gt;flaot并且清除float来解决这个问题；另外一个办法就是触发&lt;a&gt;的hasLayout（如定 义高宽、使用zoom:1;）；也可以给&lt;li&gt; 定义display:inline;来解决此问题；另外还有一个极有趣的方法，给包含的文本末尾添加一个空格。<br/><br/>22、IE6中的:hover<br/><br/>在IE6中，除了(需要有href属性)才能触发:hover行为，这妨碍了我们实现许多鼠标触碰效果，但还是有一些法子是可以解决它的。最好是不要用:hover来实现重要的功能，仅仅只用它来强化效果。<br/><br/>23、IE6调整窗口大小的 Bug<br/><br/>当把body居中放置，改变IE浏览器大小的时候，任何在body里面的相对定位元素都会固定不动了。解决办法：给body定义position:relative;就行了。<br/><br/>24、文本重复Bug<br/><br/>在IE6中，一些隐藏的元素（如注释、display:none;的元素）被包含在一个浮动元素里，就有可能引发文本重复bug。解决办法：给浮动元素添加display:inline;。<br/>]]></description>
		</item>
		
			<item>
			<link>http://www.woaicss.com/article/hack/jiaodian.htm</link>
			<title><![CDATA[去掉焦点虚线]]></title>
			<author>wo-ai-niqq@163.com(woniu)</author>
			<category><![CDATA[Hack]]></category>
			<pubDate>Mon,10 May 2010 14:56:55 +0800</pubDate>
			<guid>http://www.woaicss.com/default.asp?id=189</guid>
		<description><![CDATA[在网上找到的方法,挨个试了下：<br/><strong>一 在&lt;a&gt;标签中加入onFocus=&#34;this.blur()&#34;语句： </strong><br/><br/>&lt;a href=&#34;#&#34; onFocus=&#34;this.blur()&#34;&gt;try&lt;/a&gt;<br/>方法笨，但是好使，<span style="color:Teal">兼容ie,ff</span>。<br/> <br/><strong>二 在&lt;a&gt;标签中加入hidefocus：</strong> <br/><br/>&lt;a href=&#34;###&#34; hidefocus&gt;link&lt;/a&gt;<br/><span style="color:Teal">ff下不起作用。</span><br/><br/><strong>三 如果连接太多，可以用外部链接 .HTC 文件。</strong> <br/>如，blur.htc 文件内容如下： <br/><br/>&lt;public:attach event=&#34;onfocus&#34; onevent=&#34;makeblur()&#34;/&gt; <br/>&lt;script language=&#34;javascript&#34;&gt; <br/>function makeblur(){ <br/>this.blur(); <br/>} <br/>&lt;/script&gt;<br/><br/>在 CSS 中加入如下代码： <br/>A { behavior:url(blur.htc); } <br/><span style="color:Teal">ff下不起作用。</span><br/><br/><strong>四 使用CSS样式，可加入代码：</strong> <br/><br/>a {blr:e&#173;xpression(this.onFocus=this.blur())}<br/><span style="color:Teal">ff不起作用</span><br/><br/>第一种方法虽然起作用，但是如果一个页面很多链接就很麻烦了，理想的办法：<br/><span style="color:Red">在第四种的基础上 加个a{outline:none;}</span>]]></description>
		</item>
		
			<item>
			<link>http://www.woaicss.com/article/hack/hack20.htm</link>
			<title><![CDATA[IE下li下面空隙问题]]></title>
			<author>wo-ai-niqq@163.com(woniu)</author>
			<category><![CDATA[Hack]]></category>
			<pubDate>Mon,01 Mar 2010 22:33:53 +0800</pubDate>
			<guid>http://www.woaicss.com/default.asp?id=179</guid>
		<description><![CDATA[&nbsp;&nbsp;这个问题也经常遇到，见群里有人问，就写出来。发生情况：当li嵌套其它浮动元素时，在IE下（确切说IE6、IE7下，IE8没发现）占用的高度比实际高度搞出来大约3px，表现为li下面有3px的间隙。看下面代码：<br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.woaicss.com/images/html.gif" style="margin:0px 2px -3px 0px"> HTML代码</div><div class="UBBContent"><TEXTAREA rows="8" id="temp51160">

<!DOCTYPE html PUBLIC &#34;-//W3C//DTD XHTML 1.0 Transitional//EN&#34; &#34;<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" target="_blank" rel="external">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</a>&#34;>
<html xmlns=&#34;<a href="http://www.w3.org/1999/xhtml" target="_blank" rel="external">http://www.w3.org/1999/xhtml</a>&#34;>
<head>
<meta http-equiv=&#34;Content-Type&#34; content=&#34;text/html; charset=utf-8&#34; />
<title>woaicss</title>
<style type=&#34;text/css&#34;>
	<!--
	li{height:20px;background:red;list-style-type:none;}
	li a{float:left;}
	span{float:left;}
	
	-->
</style>	
</head>
<body>
   <ul>
        <li><span>蜗爱css11111蜗爱css11111</span></li>
        <li><a href=&#34;&#34;>蜗爱css11111</a></li>
        <li><a href=&#34;&#34;>蜗爱css11111</a></li>
        <li><a href=&#34;&#34;>蜗爱css11111</a></li>
    
    </ul>
</body>
</html>
</TEXTAREA><br/><INPUT onclick="runEx('temp51160')"  type="button" class="userbutton" value="运行此代码"/> <INPUT onclick="doCopy('temp51160')"  type="button" class="userbutton" value="复制此代码"/> <INPUT onclick="saveCode('temp51160')" type="button" class="userbutton" value="保存此代码"><br/> [Ctrl+A 全部选择 提示：你可先修改部分代码，再按运行]</div></div><br/><br/>需要说明的是，包含浮动元素才会有此bug，上面的span去掉float，运行就不会有。解决办法，让li也浮动。]]></description>
		</item>
		
			<item>
			<link>http://www.woaicss.com/article/hack/hack13.htm</link>
			<title><![CDATA[IE6下部分样式不起作用]]></title>
			<author>wo-ai-niqq@163.com(woniu)</author>
			<category><![CDATA[Hack]]></category>
			<pubDate>Tue,26 Jan 2010 17:50:30 +0800</pubDate>
			<guid>http://www.woaicss.com/default.asp?id=174</guid>
		<description><![CDATA[&nbsp;&nbsp; 之前就有遇到过，又出现了，记下来：因为设置了font-family:&#34;微软雅黑&#34;；后面的样式在ie6下就都不起作用了，改成宋体可以，黑体，幼圆不可以。去掉引号也都可以。其它可能导致ie6下样式不起作用的原因：<br/><br/>&nbsp;&nbsp;1.样式文件编码没写<br/>&nbsp;&nbsp;2.样式文件中的中文注释<br/><br/> 当然这两种情况自己没遇到过。]]></description>
		</item>
		
			<item>
			<link>http://www.woaicss.com/article/hack/css60.htm</link>
			<title><![CDATA[CSS浏览器常见兼容问题汇总]]></title>
			<author>wo-ai-niqq@163.com(woniu)</author>
			<category><![CDATA[Hack]]></category>
			<pubDate>Tue,15 Dec 2009 19:26:19 +0800</pubDate>
			<guid>http://www.woaicss.com/default.asp?id=153</guid>
		<description><![CDATA[&nbsp;&nbsp;<strong>div类</strong><br/>1. 居中问题<br/>div里的内容，IE默认为居中，而FF默认为左对齐<br/>可以尝试增加代码margin:auto<br/><br/>2. 高度问题<br/>两上下排列或嵌套的div，上面的div设置高度(height)，如果div里的实际内容大于所设高度，在FF中会出现两个div重叠的现象；但在IE中，下面的div会自动给上面的div让出空间<br/>所以为避免出现层的重叠，高度一定要控制恰当，或者干脆不写高度，让他自动调节，比较好的方法是 height:100%;<br/>但当这个div里面一级的元素都float了的时候，则需要在div块的最后，闭和前加一个沉底的空div，对应CSS是：<br/>.float_bottom {clear:both;height:0px;font-size:0px;padding:0;margin:0;border:0;line-height:0px;overflow:hidden;}<br/><br/>3. clear:both;<br/>不想受到float浮动的，就在div中写入clear:both;<br/><br/>4. IE浮动 margin 产生的双倍距离<br/>#box {<br/>float:left;<br/>width:100px;<br/>margin:0 0 0 100px; //这种情况之下IE会产生200px的距离<br/>display:inline; //使浮动忽略<br/>}<br/><br/>5. padding 问题<br/>FF设置 padding 后，div会增加 height 和 width，但IE不会 （* 标准的 XHTML1.0 定义 dtd 好像一致了）<br/>高度控制恰当，或尝试使用 height:100%;<br/>宽度减少使用 padding<br/>但根据实际经验，一般FF和IE的 padding 不会有太大区别，div 的实际宽 = width + padding ，所以div写全 width 和 padding，width 用实际想要的宽减去 padding 定义<br/><br/>6. div嵌套时 y 轴上 padding 和 marign 的问题<br/>FF里 y 轴上 子div 到 父div 的距离为 父padding + 子marign<br/>IE里 y 轴上 子div 到 父div 的距离为 父padding 和 子marign 里大的一个<br/>FF里 y 轴上 父padding=0 且 border=0 时，子div 到 父div 的距离为0，子marign 作用到 父div 外面<br/><br/>7. padding，marign，height，width 的傻瓜式解决技巧<br/>注意是技巧，不是方法：<br/>写好标准头<br/>&lt;!DOCTYPE html PUBLIC &#34;-//W3C//DTD XHTML 1.0 Transitional//EN&#34; &#34;<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" target="_blank" rel="external">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</a>&#34;&gt;<br/>&lt;html xmlns=&#34;<a href="http://www.w3.org/1999/xhtml" target="_blank" rel="external">http://www.w3.org/1999/xhtml</a>&#34;&gt;<br/>高尽量用padding，慎用margin，height尽量补上100%，父级height有定值子级height不用100%，子级全为浮动时底部补个空clear:both的div<br/>宽尽量用margin，慎用padding，width算准实际要的减去padding<br/><br/><strong>列表类</strong><br/><br/>1. ul 标签在FF中默认是有 padding 值的，而在IE中只有margin有值<br/>先定义 ul {margin:0;padding:0;}<br/><br/>2. ul和ol列表缩进问题<br/>消除ul、ol等列表的缩进时，样式应写成: {list-style:none;margin:0px;padding:0px;}<br/><br/>显示类<br/><br/>1. display:block,inline 两个元素<br/>display:block; //可以为内嵌元素模拟为块元素<br/>display:inline; //实现同一行排列的的效果<br/>display:table; //for FF,模拟table的效果<br/>display:block 块元素，元素的特点是：<br/>总是在新行上开始；<br/>高度，行高以及顶和底边距都可控制；<br/>宽度缺省是它的容器的100%，除非设定一个宽度<br/>&lt;div&gt;，&lt;p&gt;，&lt;h1&gt;，&lt;form&gt;，&lt;ul&gt; 和 &lt;li&gt; 是块元素的例子<br/>display:inline 就是将元素显示为行内元素，元素的特点是：<br/>和其他元素都在一行上；<br/>高，行高及顶和底边距不可改变；<br/>宽度就是它的文字或图片的宽度，不可改变。<br/>&lt;span&gt;，&lt;a&gt;，&lt;label&gt;，&lt;input&gt;，&lt;img&gt;，&lt;strong&gt; 和 &lt;em&gt; 是 inline 元素的例子<br/><br/>2. 鼠标手指状显示<br/>全部用标准的写法 cursor: pointer; <br/><br/><strong>背景、图片类</strong><br/><br/>1. background 显示问题<br/>全部注意补齐 width，height 属性<br/><br/>2. 背景透明问题<br/>IE: filter: progid: DXImageTransform.Microsoft.Alpha(style=0,opacity=60);<br/>IE: filter: alpha(opacity=10);<br/>FF: opacity:0.6;<br/>FF: -moz-opacity:0.10;<br/>最好两个都写，并将opacity属性放在下面<br/><br/>源文：<a href="http://bbs.blueidea.com/thread-2941700-1-2.html" target="_blank" rel="external">http://bbs.blueidea.com/thread-2941700-1-2.html</a> <br/>]]></description>
		</item>
		
			<item>
			<link>http://www.woaicss.com/article/hack/hack10.htm</link>
			<title><![CDATA[IE下<li>元素产生间距的BUG]]></title>
			<author>wo-ai-niqq@163.com(woniu)</author>
			<category><![CDATA[Hack]]></category>
			<pubDate>Wed,02 Dec 2009 20:16:57 +0800</pubDate>
			<guid>http://www.woaicss.com/default.asp?id=144</guid>
		<description><![CDATA[&nbsp;&nbsp;当li元素设置了高度，且li内元素浮动时会触发该bug。<br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.woaicss.com/images/html.gif" style="margin:0px 2px -3px 0px"> HTML代码</div><div class="UBBContent"><TEXTAREA rows="8" id="temp92933">
<style>
li{ background-color: green; height: 20px; }
li a { float: left; }
li span { float: right; }
</style>

<ul>
<li><a href=&#34;&#34;>aaa</a><span>bbb</span></li>
<li><a href=&#34;&#34;>aaa</a><span>bbb</span></li>
</ul>
</TEXTAREA><br/><INPUT onclick="runEx('temp92933')"  type="button" class="userbutton" value="运行此代码"/> <INPUT onclick="doCopy('temp92933')"  type="button" class="userbutton" value="复制此代码"/> <INPUT onclick="saveCode('temp92933')" type="button" class="userbutton" value="保存此代码"><br/> [Ctrl+A 全部选择 提示：你可先修改部分代码，再按运行]</div></div><br/><br/><span style="color:Red">解决方法：</span>li设置css vertical-align: bottom;<br/><br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.woaicss.com/images/html.gif" style="margin:0px 2px -3px 0px"> HTML代码</div><div class="UBBContent"><TEXTAREA rows="8" id="temp5">

<style>
li{ background-color: green; height: 20px; vertical-align: bottom; }
li a { float: left; }
li span { float: right; }
</style>

<ul>
<li><a href=&#34;&#34;>aaa</a><span>bbb</span></li>
<li><a href=&#34;&#34;>aaa</a><span>bbb</span></li>
</ul>
</TEXTAREA><br/><INPUT onclick="runEx('temp5')"  type="button" class="userbutton" value="运行此代码"/> <INPUT onclick="doCopy('temp5')"  type="button" class="userbutton" value="复制此代码"/> <INPUT onclick="saveCode('temp5')" type="button" class="userbutton" value="保存此代码"><br/> [Ctrl+A 全部选择 提示：你可先修改部分代码，再按运行]</div></div><br/><br/>&nbsp;&nbsp;上边的方法一般都会解决问题，但是许多时候许多未知的原因，还会导致间距问题的出现。试试以下方法：<br/>1.定义行高 line-height<br/>2.设置隐藏 overflow:hidden<br/>3.li增加浮动属性 float<br/>]]></description>
		</item>
		
			<item>
			<link>http://www.woaicss.com/article/hack/hack12.htm</link>
			<title><![CDATA[Firefox下margin-top问题]]></title>
			<author>wo-ai-niqq@163.com(woniu)</author>
			<category><![CDATA[Hack]]></category>
			<pubDate>Fri,27 Nov 2009 14:39:11 +0800</pubDate>
			<guid>http://www.woaicss.com/default.asp?id=142</guid>
		<description><![CDATA[&nbsp;&nbsp;很早之前就有发现这个问题，也慢慢的摸索出了一些避免这个问题的规律，但是因为比较懒，迟迟没有细究原因，今天再次遇到，忍无可忍...一探究竟。<br/><br/><div align="center"><img src="http://www.woaicss.com/attachments/month_0911/o20091127171451.jpg" border="0" alt=""/></div><br/><br/>&nbsp;&nbsp; 长出现两种情况<br/><br/>&nbsp;&nbsp;<strong>（一）margin-top失效</strong>&nbsp;&nbsp; <br/>&nbsp;&nbsp; 先看下面代码：<br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.woaicss.com/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> Example Source Code </div><div class="UBBContent"><br/>&lt;div&gt;<br/> &lt;div class=&#34;box1&#34; &gt;float:left&lt;/div&gt;<br/> &lt;div class=&#34;box2&#34;&gt;clear:both; margin-top:20px;&lt;/div&gt;<br/>&lt;/div&gt;<br/></div></div><br/>&nbsp;&nbsp;两个层box1和box2，box1具有浮动属性，box2没有，这时候设置box2的上边距 margin-top没有效果。<br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.woaicss.com/images/html.gif" style="margin:0px 2px -3px 0px"> HTML代码</div><div class="UBBContent"><TEXTAREA rows="8" id="temp9846">
<!DOCTYPE html PUBLIC &#34;-//W3C//DTD XHTML 1.0 Transitional//EN&#34; &#34;<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" target="_blank" rel="external">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</a>&#34;>
<html xmlns=&#34;<a href="http://www.w3.org/1999/xhtml" target="_blank" rel="external">http://www.w3.org/1999/xhtml</a>&#34;>
<head>
<meta http-equiv=&#34;Content-Type&#34; content=&#34;text/html; charset=utf-8&#34; />
<title>www.woaicss.com</title>
<style type=&#34;text/css&#34;>
<!--
* {
	margin:0;
	padding:0;
}
.box1{
	float:left; 
	width:500px; 
	height:100px; 
	background:#999;
	}


.box2{
	margin-top:20px; 
	width:500px; 
	height:50px; 
	background:#000; 
	color:#fff;
	clear:both;
	}
-->

</style>
</head>
<body>
<div>
  <div class=&#34;box1&#34; >float:left</div>
   <div class=&#34;box2&#34;>clear:both; margin-top:20px;</div>
</div>
</body>
</html>
</TEXTAREA><br/><INPUT onclick="runEx('temp9846')"  type="button" class="userbutton" value="运行此代码"/> <INPUT onclick="doCopy('temp9846')"  type="button" class="userbutton" value="复制此代码"/> <INPUT onclick="saveCode('temp9846')" type="button" class="userbutton" value="保存此代码"><br/> [Ctrl+A 全部选择 提示：你可先修改部分代码，再按运行]</div></div><br/><br/>&nbsp;&nbsp;网上能找到的两种比较靠谱的解释：1：“在css2.1中，水平的margin不会被折叠；垂直margin可能在一些盒模型中被折叠…”2：当第一个层浮动，而第二个没浮动层的margin会被压缩，详见--浮动元素后非浮动元素的margin的处理（<a target="_blank" href="http://www.w3.org/TR/2008/REC-CSS2-20080411/visuren.html#floats" rel="external">地址</a>）。<br/><br/>得到解决问题思路：要浮动一起浮动，要就一起不浮动。<br/><br/><span style="color:Red">解决办法：</span><br/><br/>1.box2增加float属性<br/>2.box1与box2之间增加一层&#34;&lt;div style=&#34;clear:both;&#34;&gt;&lt;/div&gt;&#34;<br/><br/>&nbsp;&nbsp;<strong>（二）子元素设置margin-top作用于父容器</strong><br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.woaicss.com/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> Example Source Code </div><div class="UBBContent"><br/>&lt;div class=&#34;box&#34; style=&#34;height:100px;background:red;&#34;&gt;<br/>&nbsp;&nbsp;&lt;div class=&#34;box2&#34;&gt;clear:both; margin-top:20px;height:50px;width:500px;background:#000;&lt;/div&gt;<br/>&lt;/div&gt;<br/></div></div><br/>当给box2设置margin-top时，在FF下仅作用于父容器。<br/><div class="UBBPanel"><div class="UBBTitle"><img src="http://www.woaicss.com/images/html.gif" style="margin:0px 2px -3px 0px"> HTML代码</div><div class="UBBContent"><TEXTAREA rows="8" id="temp47635">

<!DOCTYPE html PUBLIC &#34;-//W3C//DTD XHTML 1.0 Transitional//EN&#34; &#34;<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" target="_blank" rel="external">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</a>&#34;>
<html xmlns=&#34;<a href="http://www.w3.org/1999/xhtml" target="_blank" rel="external">http://www.w3.org/1999/xhtml</a>&#34;>
<head>
<meta http-equiv=&#34;Content-Type&#34; content=&#34;text/html; charset=utf-8&#34; />
<title>www.woaicss.com</title>
<style type=&#34;text/css&#34;>
<!--
* {
	margin:0;
	padding:0;
}

.box2{
	margin-top:20px; 
	width:500px; 
	height:50px; 
	background:#000; 
	color:#fff;
	
	}
-->

</style>
</head>
<body>
<div class=&#34;box&#34; style=&#34;height:100px;background:red;&#34;>
  <div class=&#34;box2&#34;>clear:both; margin-top:20px;height:50px;width:500px;background:#000;</div>
</div>
</body>
</html>
</TEXTAREA><br/><INPUT onclick="runEx('temp47635')"  type="button" class="userbutton" value="运行此代码"/> <INPUT onclick="doCopy('temp47635')"  type="button" class="userbutton" value="复制此代码"/> <INPUT onclick="saveCode('temp47635')" type="button" class="userbutton" value="保存此代码"><br/> [Ctrl+A 全部选择 提示：你可先修改部分代码，再按运行]</div></div><br/><br/><span style="color:Red">解决办法：</span><br/><br/>1.给父容器box加overflow:hidden;属性<br/>2.父容器box加border除none以外的属性<br/>3.用父容器box的padding-top代替margin-top<br/><br/>自己工作中遇到的总结，可能会有不严谨的地方，如有发现希望指出！<br/><br/><span style="color:Red">本文原创--转载注明出处！</span>http://www.woaicss.com<br/>]]></description>
		</item>
		
			<item>
			<link>http://www.woaicss.com/article/hack/hack10.htm</link>
			<title><![CDATA[再谈IE6下png不透明问题]]></title>
			<author>wo-ai-niqq@163.com(woniu)</author>
			<category><![CDATA[Hack]]></category>
			<pubDate>Wed,11 Nov 2009 09:26:19 +0800</pubDate>
			<guid>http://www.woaicss.com/default.asp?id=136</guid>
		<description><![CDATA[&nbsp;&nbsp; 很早之前写过一篇解决ie6下png不透明的方法--<a target="_blank" href="http://www.woaicss.com/article/hack/ie6hack.htm" rel="external">《解决PNG图片在IE6下背景不透明的问题》</a>用的滤镜，好处是不用js，坏处是每个png图片都要写一遍滤镜样式而且不能平铺。蓝色上看到的yuanyun翻译的<a target="_blank" href="http://labs.unitinteractive.com/unitpngfix.php" rel="external">《Unit PNG Fix 》</a>，下次试试这种方法。<br/>-----------------------------------------------------------------------------------------------------<br/>咳! 哎! 咳! 哎!.....&nbsp;&nbsp;&nbsp;&nbsp;&#34;<br/><br/>你听见了么? 这些都是大家抱怨IE6下不能实现png图片漂亮的明效果的哀叫声,的确是非常无奈.....<br/><br/>不过现在很幸运的是,我们能够让这一切的抱怨都停止.<br/><br/>网络上解决IE6 Png透明解决方案有很多,<br/>例如 <a target="_blank" href="http://www.twinhelix.com/css/iepngfix/" rel="external">IE PNG Fix from TwinHelix</a>, <a target="_blank" href="http://homepage.ntlworld.com/bobosola/index.htm" rel="external">Javascript IE PNG Fix</a>, <a target="_blank" href="http://24ways.org/2007/supersleight-transparent-png-in-ie6" rel="external">Transparent PNGs in Internet Explorer 6 from 24 ways</a>.等等.<br/><br/>然而现在,我要和你分享的是 Unit PNG Fix . <br/><br/><img src="http://www.woaicss.com/attachments/month_0911/u2009111192157.png" border="0" alt=""/><br/><br/><strong>因为它的确是太出众了。</strong><br/><br/>1.非常小的javascript文件:1kb!<br/>2.解决因为IE的滤镜属性所带来的影响.<br/>3.无论是img元素或background-image属性,都能有效果.<br/>4.在加载页面之前就能自动运行.或者就一丁点的元素.<br/>5.允许自动高宽.<br/>6.使用起来超级简单.<br/><br/><br/><strong>如何使用:</strong><br/><br/>1).<img src="http://www.woaicss.com/images/download.gif" alt="下载文件" style="margin:0px 2px -4px 0px"/> <a href="http://www.woaicss.com/attachments/month_0911/52009111192445.zip" target="_blank">下载zip</a><br/>然后,添加下面的代码到你页面的头部.(一定要确保路径的正确)<br/><br/><span style="color:Red">&lt;!--[if lt IE 7]&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;script type=&#34;text/javascript&#34; src=&#34;unitpngfix.js&#34;&gt;&lt;/script&gt;<br/>&lt;![endif]--&gt;</span><br/><br/>2).添加clear.gif到你的images 文件夹中.在js文件中,修改&#34;<span style="color:Red">var clear=&#34;images/clear.gif</span>&#34; 路径,为你存放clear.gif的文件路径.<br/><br/><br/>3). 你的整个项目的png图片都实现了透明效果.的确非常简单吧?就2个步骤,就实现了整个站点所有png的透明效果.<br/><br/><br/><strong>一些注意事项:</strong><br/><br/>Unit PNG Fix能够让 background-repeat在ie6下工作,<br/>不过这种工作方式不是像正常的repeat图片重复的效果,而是采用了拉伸的效果.<br/>但是,仍然是有效果的,所以这也是非常不错的.因为没有任何一个解决方案能够实现ie6下透明滤镜重复图片这个功能.<br/><br/>就这些了,现在你可以开始动手实践了. <br/><br/><a target="_blank" href="http://labs.unitinteractive.com/unitpngfix.php" rel="external">阅读英文原文</a><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.woaicss.com/article/hack/css34.htm</link>
			<title><![CDATA[包括IE8的浏览器兼容hack汇总]]></title>
			<author>wo-ai-niqq@163.com(woniu)</author>
			<category><![CDATA[Hack]]></category>
			<pubDate>Tue,13 Oct 2009 09:06:13 +0800</pubDate>
			<guid>http://www.woaicss.com/default.asp?id=118</guid>
		<description><![CDATA[&nbsp;&nbsp; 网上很多，这类的兼容问题的汇总，但是个人不经常hack。IE8的hack用的更少。贴出来以备以后查阅。<br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.woaicss.com/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> Example Source Code </div><div class="UBBContent"><br/><span style="color:#000000">#box{</span><br/><span style="color:#008000">color</span><span style="color:#0000ff">:</span>red<span style="color:#0000ff">;</span> <span style="color:#008080">/* 所有浏览器都支持 */</span> <br/><span style="color:#008000">color</span><span style="color:#0000ff">:</span>red <span style="color:#0000ff">!</span>important<span style="color:#0000ff">;</span><span style="color:#008080">/* Firefox、IE7支持 */</span><br/>_color<span style="color:#0000ff">:</span>red<span style="color:#0000ff">;</span> <span style="color:#008080">/* IE6支持 */</span><br/><span style="color:#0000ff">*</span><span style="color:#008000">color</span><span style="color:#0000ff">:</span>red<span style="color:#0000ff">;</span> <span style="color:#008080">/* IE6、IE7支持 */</span><br/><span style="color:#0000ff">*</span><span style="color:#0000ff">+</span><span style="color:#008000">color</span><span style="color:#0000ff">:</span>red<span style="color:#0000ff">;</span> <span style="color:#008080">/* IE7支持 */</span><br/><span style="color:#008000">color</span><span style="color:#0000ff">:</span>red\9<span style="color:#0000ff">;</span> <span style="color:#008080">/* IE6、IE7、IE8支持 */</span><br/><span style="color:#008000">color</span><span style="color:#0000ff">:</span>red\0<span style="color:#0000ff">;</span> <span style="color:#008080">/* IE8支持 */</span><br/><span style="color:#0000ff">}<br/></span><br/></div></div>]]></description>
		</item>
		
			<item>
			<link>http://www.woaicss.com/article/hack/css28.htm</link>
			<title><![CDATA[firefox背景水平不平铺]]></title>
			<author>wo-ai-niqq@163.com(woniu)</author>
			<category><![CDATA[Hack]]></category>
			<pubDate>Tue,29 Sep 2009 16:31:57 +0800</pubDate>
			<guid>http://www.woaicss.com/default.asp?id=112</guid>
		<description><![CDATA[&nbsp;&nbsp;老问题了，如在#wrapper{background:url(&#34;bg.gif&#34;) repeat-x;}在IE下是没问题的，但是FF下必须指定height才能显示，大多数情况下都是动态高度于是设置下面的即可overflow:auto;或者overflow:hidden;<br/> 垂直平铺同样。<br/> 注：overflow:auto;有清除浮动的作用。见文：<a href="http://www.css88.com/archives/543" target="_blank" rel="external">http://www.css88.com/archives/543</a>]]></description>
		</item>
		
</channel>
</rss>
