火狐与IE兼容性总结(二)

摘要:
答案是提高的优先级。aa,例如#aaulli。aaweb标准常见问题解答18。IE6无法定义高度约为1px的容器。在IE6中,这个问题是由默认行高度引起的,有很多方法可以解决,例如:溢出:hiddenzoom:0.08line-height:1px19。无法显示背景色20。如何在FLASH上显示图层?解决方案是设置FLASH的透明度--Div{position:absolute;top:50%;left:50%;margin:-100px00-100px;width:200px;height:200px,border:1px solid;}--˃22。图片垂直于容器˂!

16.    为什么web标准中IE无法设置滚动条颜色了
    解决办法是将body换成html

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
  3. <style type="text/css">
  4. <!--
  5. html {
  6.          scrollbar-face-color:#f6f6f6;
  7.          scrollbar-highlight-color:#fff;
  8.          scrollbar-shadow-color:#eeeeee;
  9.          scrollbar-3dlight-color:#eeeeee;
  10.          scrollbar-arrow-color:#000;
  11.          scrollbar-track-color:#fff;
  12.          scrollbar-darkshadow-color:#fff;
  13.      }
  14. -->
  15. </style>

17.    为什么我定义的样式没有作用呢
    这里你无法用.aa定义到li 遇到这种情况怎么解决呢?答案是提高.aa 的优先权 比如#aa ul li.aa

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
  3. <style type="text/css">
  4.      <!--
  5.      #aa ul li {
  6.              color:red
  7.          }
  8.      .aa {
  9.              color:blue
  10.          }
  11.      -->
  12. </style>    
  13. <div id="aa">    
  14. <ul>
  15. <li class="aa">    
  16.      web标准常见问题大全
  17. </li>
  18. </ul>
  19. </div>

18.    IE6无法定义1px左右高度的容器
    IE6下这个问题是因为默认的行高造成的,解决的方法也有很多,例如:

  1. overflow:hidden zoom:0.08 line-height:1px

19.    背景颜色无法显示

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
  3. <style type="text/css">
  4. <!--
  5. ul {
  6.          background:red
  7.      }
  8. li {
  9.          float:left;
  10.          180px;
  11.      }
  12. -->
  13. </style>
  14. <!--[if lte IE 6]>
  15. <style>
  16. .gainlayout { height: 1px; }
  17. </style>
  18. <![endif]-->  
  19. <ul class="gainlayout">
  20. <li>web标准常见问题大全</li>
  21. <li>web标准常见问题大全</li>
  22. <li>web标准常见问题大全</li>
  23. <li>web标准常见问题大全</li>
  24. <li>web标准常见问题大全</li>
  25. <div style="clear:both"></div>
  26. </ul>

IE中设置有背景色的ul并没有显示出来,这个属于haslayout问题,解决的办法也很多参考 http://www.satzansatz.de/cssd/onhavinglayout.htm
    解决方法之一:

  1. <!--[if lte IE 6]>
  2. <style>    
  3. .gainlayout { height: 1px; }    
  4. </style>    
  5. <![endif]-->     
  6. <!--[if lte IE 6]>
  7. <style>
  8. .gainlayout { height: 1px; }
  9. </style>
  10. <![endif]-->

20.    怎么样才能让层显示在FLASH之上呢
    解决的办法是给FLASH设置透明

  1. <param name="wmode" value="transparent" />  

21.    怎样使一个层垂直居中于浏览器中
    这里我们使用百分比绝对定位,与外补丁负值的方法,负值的大小为其自身宽度高度除以二

  1. <style type="text/css">    
  2. <!--     
  3. div {    
  4.         position:absolute;    
  5.          top:50%;    
  6.          left:50%;    
  7.         margin:-100px 0 0 -100px;    
  8.         width:200px;    
  9.         height:200px;    
  10.         border:1px solid red;    
  11.      }    
  12. -->    
  13. </style>

22.    图片垂直与容器内

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <style type="text/css">
  3. <!--
  4. * {margin:0;padding:0}
  5. div {
  6.          500px;
  7.          height:500px;
  8.          border:1px solid #ccc;
  9.          overflow:hidden;
  10.          position:relative;
  11.          display:table-cell;
  12.          text-align:center;
  13.          vertical-align:middle
  14.      }
  15. div p {
  16.          position:static;
  17.          +position:absolute;
  18.          top:50%
  19.      }
  20. img {
  21.          position:static;
  22.          +position:relative;
  23.          top:-50%;left:-50%;
  24.          276px;
  25.          height:110px
  26.      }
  27. -->
  28. </style>
  29. <div><p><img src="logo.gif" /></p></div>

或者使用背景图的办法:

  1. background:url("logo.gif") center no-repeat;

23.    如何让div横向排列
    横向排列DIV可以使用浮动的方式比如float:left,或者设置对象为内联,还可以绝对定位对象等等.

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">    
  2. <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />    
  3. <style type="text/css">    
  4. <!--     
  5. div {    
  6.          float:left;
  7.          200px;
  8.          height:200px;
  9.          border:1px solid red
  10.      }
  11. -->
  12. </style>
  13. <div>web标准常见问题大全</div>
  14. <div>web标准常见问题大全</div>
  15. <div>web标准常见问题大全</div>

24 Firefox 关于DIV高度无法自适应的两种解决
    如果设置了一个DIV的高度,当DIV里实际内容大于所设高度,ie会自动拉伸以适应DIV容器大小,ff会固定DIV的高度,超过部分超出DIV底线以外,
    出现和下面的内容重叠的现象。如果不给DIV设置高度,在Firefox中将不回因为里面的内容而撑开,而IE中就会自动根据内容撑开
    解决方案:
    1、在DIV内部的最后追加clear:both样式

  1. <div style="background-color:#FF0000;">
  2.     <div style="float:left; height:200px">Jmedia Design</div>
  3.     <div style="float:right; height:800px">www.jmedia.cn</div>
  4.     <div style="clear:both"></div>
  5. </div>

    2、对DIV使用overflow:auto;

  1. <div style="overflow:auto;">
  2.     <div style="float:left; background-color:#000000;height:200px">1111111111</div>
  3.     <div style="float:right;background-color:#000000; height:300px"">2222222222</div>
  4. </div>

转自:http://hi.baidu.com/dpxdqx/blog/item/53337208106cf3d862d9868f.html

免责声明:文章转载自《火狐与IE兼容性总结(二)》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇HBase性能优化方法总结shell脚本(2)-shell脚本语法下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

解决IE8的兼容问题

本文分享下我在项目中积累的IE8+兼容性问题的解决方法。根据我的实践经验,如果你在写HTML/CSS时候是按照W3C推荐的方式写的,然后下面的几点都关注过,那么基本上很大一部分IE8+兼容性问题都OK了(这里的IE8+主要是指IE8,据个人目测,IE9+的渲染效果已经非常好了)。 前期准备 测试IE兼容性必须要在Windows中测,而且是Win7+,因为W...

IE “浏览器模式”和“文档模式”的区别

IE“浏览器模式”用于切换IE针对该网页的默认文档模式、对不同版本浏览器的条件备注解析、发送给网站服务器的用户代理(User-Agent)字符串的值。网站可以根据浏览器返回的不同用户代理字符串判断浏览器的版本和安装的功能,这样就可以向不同的浏览器返回不同的页面内容。 默认情况下,IE8的浏览器模式为IE8。用户可以通过单击地址栏旁边的兼容性视图按钮来手动切...

window.location.hash在firefox下中文自动转码为UTF-8问题

1.window.location.hash window.location.hash这个属性主要是读取和写入网页位置的,我们经常会用来控制网页单页面跳转或者是控制网页位置。然而这个属性在firefox下遇到中文时却会被自动转码为UTF-8,这是火狐等相似浏览器对中文url的一些处理的不同。以下介绍一个方法可以fixed掉这个问题。 2.解码函数 前面已经...

java环境安装Firefox驱动/IE驱动

FireFox: 1、检查本地Firefox浏览器的版本 2、去官网下载对应版本的驱动 Change Log :https://github.com/mozilla/geckodriver/blob/release/CHANGES.md Firefox各版本: http://ftp.mozilla.org/pub/firefox/releases/ Fir...

Firefox浏览器怎么安装adobe flash player插件

https://jingyan.baidu.com/article/0a52e3f435d171bf62ed7237.html 有些朋友在使用Firefox火狐浏览器,但是火狐浏览器安装以后是没有flash player插件的。那么我们怎么安装flash player插件呢,其实方法有很多,这里小编介绍一下Firefox火狐浏览器怎么安装flash pl...

常用css3属性的ie兼容查看

记录一下关于css3的各种常用属性对ie各版本浏览器的兼容程度; 最低可兼容ie7 最低可兼容ie8 最低可兼容ie9 最低可兼容ie10 position:fixed clip E:first-letter E::first-letter E:first-line E::first-line box-sizing E:after/E::af...