日志标签:IE6 BUG

【IE6的疯狂之二】IE6中PNG Alpha透明(全集)

时间:2009年03月26日作者:愚人码头查看次数:11,419 views评论次数:17

ie7,fireofx,opera,及至webkit内核的chrome ,safari….. 这些浏览器均支持png的Alpha透明。

很多人说IE6不支持PNG透明,其实IE支持100%透明的PNG,疯狂的IE6只是不支持png的Alpha透明。

这个BUG给我们带来了很大的困扰。

但是这仍然存在很多问题,比如半透明的PNG背景图片。

Gulu77整理了4种IE6中PNG Alpha透明的方法:

测试实例:http://www.css88.com/demo/IE6_bug/IE6_bug_2/test_IE6png8/index.html

这里用IE6测试,插入的图片和背景图片没有透明。


第一种方法:AlphaImageLoader 筛选器

微软给出了一个解决方案:http://support.microsoft.com/kb/294714/zh-cn

使用简介:在每个标签样式中插入 filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=’image.png’, sizingMethod=’scale’)

注意事项:

AlphaImageLoader难以实现插入图片<img src=”.png”/>透明

AlphaImageLoader方法用于背景图片上,实现background-image的效果

AlphaImageLoader IE8不支持

因为IE7支持AlphaImageLoader,避免冲突建议使用CSS hack区分开,只针对IE6使用

测试实例:http://www.css88.com/demo/IE6_bug/IE6_bug_2/test_AlphaImageLoader/index.html


第二种方法:PNG Transparency in IE

使用简介:相对来说比较简洁,使用一段包含滤镜的JavaScript 就可以模拟图片或背景 PNG alpha 透明度

注意事项:
根目录的spacer.gif透明图片作为png图片的替换,写在JavaScript中的spacer.gif路径根据需要调整
PNGTransparncyinIE方法在背景应用上只能做到background-image的效果, 背景重复坐标调用等暂时实现不了

官方原文:http://codingforums.com/archive/index.php?t-80555.html

测试实例:http://www.css88.com/demo/IE6_bug/IE6_bug_2/test_PNGTransparncyinIE/index.html

继续阅读:【IE6的疯狂之二】IE6中PNG Alpha透明(全集)»

标签:分类:html+css

【IE6的疯狂之五】div遮盖select的解决方案

时间:2009年03月26日作者:愚人码头查看次数:9,612 views评论次数:7

IE6以及一下版本下,选择框Select会覆盖Div中的内容
一般情况下,可以将显示的内容放到Iframe中,然后再显示框架内的内容。由于Iframe的可以显示在Select上层,就可以解决这个问题。不过这样做在实现上比较麻烦。有个解决的部分就是在Div内容中加入不显示的Iframe框架即可,不用修改其他内容。
例如:http://www.css88.com/demo/div_select/div_select.html

CSS代码
  1. body { margin: 0; padding: 0; text-aligncenterbackground-color#eee; }   
  2. #bd { margin20px autopadding5px 20px 20pxborder1px solid #bbbwidth760pxbackground-color:#9CCE2E;  }   
  3. #popup {width300px;height100px;padding10px;positionabsolute;left443px;top57px;border1px solid blue;background-color#fff;filter:alpha(opacity=60);opacity:0.4;}   
  4. #popup iframe{display:none;/*sorry for IE5*/display/**/:block;/*sorry for IE5*/position:absolute;/*must have*/top:0;/*must have*/left:0;/*must have*/z-index:-1;/*must have*/filter:mask();/*must have*/width: 100%;/*must have for any big value*/height: 100%;/*must have for any big value*/;}  

 

尤其注意这个样式:

#popup iframe{display:none;/*sorry for IE5*/display/**/:block;/*sorry for IE5*/position:absolute;/*must have*/top:0;/*must have*/left:0;/*must have*/z-index:-1;/*must have*/filter:mask();/*must have*/width: 100%;/*must have for any big value*/height: 100%;/*must have for any big value*/;}  

 

XML/HTML代码
  1. <div id=“bd”>  
  2. <h1>IE6下div遮盖select的解决方案</h1>  
  3. <div class=“parameter”>  
  4. <label for=“ddTest”>Test</label>  
  5. <select id=“ddTest”>  
  6. <option></option>  
  7. <option>pick me</option>  
  8. </select>  
  9. </div>  
  10. </div>  
  11. <div id=“popup”>  
  12. Is the select element poking through?   
  13. <!–[if lte IE 6.5]><iframe></iframe><![endif]–>  
  14. </div>  

转载注明:http://www.css88.com/article.asp?id=503
注意:<!–[if lte IE 6.5]><iframe></iframe><![endif]–>:表示在IE6下显示<iframe></iframe>,但是我们从样式中可以看出这个iframe是看不到的;
目前存在的bug:IE6下下拉框(select)看不到。

标签:分类:html+css

【IE6的疯狂之六】li在IE中底部3像素的BUG(增加浮动解决问题)

时间:2009年03月26日作者:愚人码头查看次数:10,236 views评论次数:19

今天开发项目中碰到一个li在IE中的BUG,先来看设计原型(如图:)

两个红色中间是<li>1px的底边框;

我写的代码如下:

=============================================================

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd“>
<html xmlns=”http://www.w3.org/1999/xhtml“>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>无标题文档</title>
<style type=”text/css”>
<!–
body,dl,dt,dd,ul,ol,li,pre,form,fieldset,input,p,blockquote,th,td,h1,h2,h3,h4,h4,h5{margin:0;padding:0}
body{font:400 12px/150% Tahoma,SimSun,Arial;color:#333;background-color:#FFFFFF}
select{font-size:12px}
ul,li{list-style:none}
img{border:none}

ul{ border-bottom:#FDD496 2px solid;border-top:#FDD496 2px solid; height:263px}
ul li{ height:43px; border-bottom:#DCDCDC 1px solid; }
.po-txt{ float:left; width:146px; height:31px; background-color:#f00; padding:12px 0 0; font-size:14px; font-weight:700; text-align:right}

–>
</style></head>

<body>

    <ul>
      <li>
      <div class=”po-txt”>通行证:</div>
      </li>
      <li>
      <div class=”po-txt”>昵称:</div>
      </li>
</ul>
</body>
</html>
 

=================================================================

在IE6,IE7下显示为(如图):貌似<li>多了个 margin-bottom:3px;

几经周折,找到了Qzone的鬼哥帮忙解决,他说在<li>上加float:left;
问题解决了,当然根据设计稿的精神还要加个width:100%;

完整的样式如下:

=====================================================

<style type=”text/css”>
<!–
body,dl,dt,dd,ul,ol,li,pre,form,fieldset,input,p,blockquote,th,td,h1,h2,h3,h4,h4,h5{margin:0;padding:0}
body{font:400 12px/150% Tahoma,SimSun,Arial;color:#333;background-color:#FFFFFF}
select{font-size:12px}
ul,li{list-style:none}
img{border:none}

ul{ border-bottom:#FDD496 2px solid;border-top:#FDD496 2px solid; height:263px}
ul li{ height:43px; border-bottom:#DCDCDC 1px solid; float:left; width:100%;}
.po-txt{ float:left; width:146px; height:31px; background-color:#f00; padding:12px 0 0; font-size:14px; font-weight:700; text-align:right}

–>
</style>

======================================================

以前我们老是研究清除浮动,想不到今天却用增加浮动来解决问题。呵呵。

 特别感谢Qzone的鬼哥!

标签:分类:html+css

【IE6的疯狂之四】IE6文字溢出BUG

时间:2009年03月25日作者:愚人码头查看次数:9,836 views评论次数:16

在IE6下使用浮动可能会出现文字重复的情况.

在IE6下,浮动层之间有注释文字的话,之前那个浮动层的内容文字就有可能遭遇一个“隐形”的复制,但是代码里查看文字可并没有多出来。

看个例子:

XML/HTML代码
  1. <!DOCTYPE html PUBLIC ”-//W3C//DTD XHTML 1.0 Transitional//EN” ”http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>  
  2. <html xmlns=“http://www.w3.org/1999/xhtml”>  
  3. <head>  
  4. <meta http-equiv=“Content-Type” content=“text/html; charset=gb2312″ />  
  5. <title>多了一只猪</title>  
  6. </head>  
  7. <body>  
  8.     <div style=“width:400px”>  
  9.         <div style=“float:left”></div>    
  10.         <!– _ –>  
  11.         <div style=“float:right;width:400px”>↓这就是多出来的那只猪</div>  
  12.     </div>  
  13. </body>  
  14. </html>  

用IE6看一下,你会发现真的会多出一只“猪”!

问题原因以及解决方法:

原因:
由注释造成文字溢出,属于IE6的BUG,溢出文字的字数=注释的条数*2-1,这里的字数在中文或英文数字时都成立。注释坐在位置与溢出位置、区块的浮动以及文字区块的固定宽度有必然联系。

解决办法:
1、不放置注释。最简单、最快捷的解决方法;
2、注释不要放置于2个浮动的区块之间;
3、将文字区块包含在新的<div></div>之间,如:<div style=”float:right;width:400px”><div>↓这就是多出来的那只猪</div></div>;
4、去除文字区块的固定宽度,与3有相似之处;
5、在后面加一个<br />或者空格;(不推荐)
6、使用IE注释格式,如:<!–[if !IE]>Put your commentary in here…<![endif]–>
7、给盒子加position:relative;属性


test.jpg
引发这种BUG有几个条件
1.是注释引起的,删除所有注释即可.
2.hidden的input直接放在form下.
3.display为none的div也有可能引发此bug.
2,3可以通过外面再包一次DIV解决

标签:分类:html+css

【IE6的疯狂之三】IE6 3像素BUG的实例

时间:2009年03月25日作者:愚人码头查看次数:10,003 views评论次数:18

问题:2列布局。左列固定,右列液态
我需要做一个布局。
2列,左边列固定宽度。右边列使用剩余宽度。整体宽度不固定,这样不管在17 还是19的屏幕上,左边列始终宽度不变,右边列宽度始终占据剩余宽度。
但是我写这个布局缺在ie6下面始终解决不了3像素bug。
请在IE6下测试

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “<a href=”http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd” target=”_blank” rel=”external”>http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd</a>”>
<!– saved from url=(0027)<a href=”http://www.chen-jing.cn/12/” target=”_blank” rel=”external”>http://www.chen-jing.cn/12/</a> –>
<HTML xmlns=”<a href=”http://www.w3.org/1999/xhtml” target=”_blank” rel=”external”>http://www.w3.org/1999/xhtml</a>”><HEAD><TITLE>关于3像素bug的延生</TITLE>
<META http-equiv=Content-Type content=”text/html; charset=gb2312″>
<STYLE type=text/css>BODY {
 FONT-SIZE: 12px
}
.a1 {
 BACKGROUND: #333; FLOAT: left; WIDTH: 100px; COLOR: #ffffff; HEIGHT: 240px
}
.a2 {
 BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; MARGIN-LEFT: 100px; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid
}
.a2 #jing {
 BACKGROUND: #00ccff; MARGIN-LEFT: -3px; HEIGHT: 100px
}
.a2 #jing2 {
 BACKGROUND: #ff9900; HEIGHT: 100px
}
</STYLE>

<META content=”MSHTML 6.00.6000.16587″ name=GENERATOR></HEAD>
<BODY>
<DIV class=a1>我是class=a1 <BR><A style=”COLOR: #ffff00″
onclick=”this.parentNode.style.height=’100px’”
href=”<a href=”http://www.chen-jing.cn/12/” target=”_blank” rel=”external”>http://www.chen-jing.cn/12/</a>#”>点击设置a1的高度为100</A><BR><A
style=”COLOR: #ffff00″ onClick=”this.parentNode.style.height=’150px’”
href=”<a href=”http://www.chen-jing.cn/12/” target=”_blank” rel=”external”>http://www.chen-jing.cn/12/</a>#”>点击设置a1的高度为150</A></DIV>
<DIV class=a2>
<DIV
id=jing>我是id=jing<BR>这个问题存在于IE6里面。ie7,opera,ff都没问题。观察class=a2的div所设置的边框会发现,a2和a1之间是没有距离的。但是a2
里面元素(文本)会和a2之间产生类似padding-left:3px;的效果。利用以往的设置负值,也没办法消除第一个元素id=jing和a2的距离。更有意思的是当我设置了_margin-left:-3px;原本id=jing和a2
之间的3像素距离变成了2像素。但是及时我_margin-left 的负值设置得再大,不能完全消除</DIV>
<DIV id=jing2>我是id=jing2<BR>当a1的高度大于id=jing这个元素的高度的时候,di=jing2
也会产生和a2之间类似padding-left:3px的间距。 当a1 小于或者等于id=jing的时候,id=jing2
就不会和a2之间有间距。<BR>本来我只是想做一个左列固定,右列自动适应剩余宽度的布局。但是没想到发现了这个问题。求某位高手告诉我怎么解决。
</DIV></DIV></BODY></HTML>

标签:分类:html+css
Page 2 of 212