- 浏览: 569162 次
- 性别:
- 来自: 深圳
文章分类
- 全部博客 (200)
- html css (6)
- javascript (11)
- php (6)
- java基础 (18)
- mysql (8)
- ssh (7)
- linux (21)
- 杂想 (1)
- 搜索引擎 (2)
- linux-shell (2)
- perl (61)
- 单元测试 (1)
- jquery (1)
- xml (1)
- 求职招聘 (1)
- 其他 (2)
- 项目工具 (2)
- maven (10)
- ant (1)
- eclipse (3)
- windows (4)
- java (8)
- jsp (1)
- c c++ (7)
- java-web (3)
- 汇编 (1)
- 正则表达式 (2)
- 网络 (1)
- 路由 (1)
- ip (1)
- 测试驱动开发 (1)
- tdd (1)
- vim (1)
- powermock (1)
- junit (1)
- spring (1)
- spring security (1)
- httpclient (1)
- sql (1)
- sqlserver (2)
- 存储过程 (1)
- apache (1)
- Nexus (1)
- 金融 (1)
- clojure (4)
- 函数式编程 (3)
- 工作 (1)
- git (2)
- java 并发 (1)
- python (1)
- java netty proxy (1)
- scala (1)
最新评论
-
springmvc-freemarker:
可以参考最新的文档:如何在eclipse jee中检出项目并转 ...
eclipse 配置maven web项目 -
zk1878:
huzhenyu 写道楼主很用心,讲得十分清楚,非常实用!呵呵 ...
eclipse 配置maven web项目 -
huzhenyu:
楼主很用心,讲得十分清楚,非常实用!
eclipse 配置maven web项目 -
宋建勇:
不错,对CountDownLatch了解加深了!
java 多线程 CountDownLatch用法 -
zk1878:
必须的。。。。
perl下载图片
from:http://www.okajax.com/a/200909/ff_ie.html
兼容性一直都是个令人头痛的问题,下面简单总结火狐与IE的兼容性问题。 1. 超链接访问过后hover样式就不出现的问题
被点击访问过的超链接样式不在具有hover和active了,很多人应该都遇到过这个问题,解决方法是改变CSS属性的排列顺序: L-V-H-A
2. FireFox下如何使连续长字段自动换行
众所周知IE中直接使用 word-wrap:break-word 就可以了, FF中我们使用JS插入的方法来解决
- <style type="text/css">
- <!--
- div {
- width:300px;
- word-wrap:break-word;
- border:1px solid red;
- }
- -->
- </style>
- <div id="ff">aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
- aaaaaaaaaaaaaaaaaaaaaaaaaaa</div>
Js代码
- <scrīpt type="text/javascrīpt">
- /* <![CDATA[ */
- function toBreakWord(el, intLen){
- var ōbj=document.getElementById(el);
- var strContent=obj.innerHTML;
- var strTemp="";
- while(strContent.length>intLen){
- strTemp+=strContent.substr(0,intLen)+"
- ";
- strContent=strContent.substr(intLen,strContent.length);
- }
- strTemp+="
- "+strContent;
- obj.innerHTML=strTemp;
- }
- if(document.getElementById && !document.all) toBreakWord("ff", 37);
- /* ]]> */
- </script>
3.ff下为什么父容器的高度不能自适应
在子容器加了浮动属性后,该容器将不能自动撑开,解决方法是在标签结束后加上一个清除浮动的元素。
- clear:both;
4.IE6的双倍边距BUG
浮动后本来外边距10px,但IE解释为20px,解决办法是加上
- display: inline
5. IE6下绝对定位的容器内文本无法正常选择
此问题在IE6、7中存在,解决问题的办法是让IE进入到qurks mode。关于qurks mode的相关知识,请参考:
http://www.microsoft.com/..
6. IE6下图片下方有空隙产生
解决这个BUG的方法也有很多,可以是改变html的排版,或者设置img 为display:block
或者设置vertical-align 属性为vertical-align:top bottom middle text-bottom都可以解决.
7. IE6下两个层中间有间隙
这个IE的3PX BUG也是经常出现的,解决的办法是给.right也同样浮动 float:left 或者相对IE6定义.left margin-right:-3px;
8. list-style-image无法准确定位
list-style-image的定位问题也是经常有人问的,解决的办法一般是用li的背景模拟,这里采用相对定位的方法也可以解决。
9. LI中内容超过长度后以省略号显示的方法
此方法适用与IE与OP浏览器
- <style type="text/css">
- <! --
- li {
- width: 200px;
- white-space:nowrap;
- text-overflow:ellipsis;
- -o-text-overflow:ellipsis;
- overflow: hidden;
- }
- -->
- </style>
10.web标准中定义id与class有什么区别吗
一.web标准中是不容许重复ID的,比如 div id="aa" 不容许重复2次,而class 定义的是类,理论上可以无限重复, 这样需要多次引用的定义便可以 使用他.
二.属性的优先级问题
ID 的优先级要高于class,看上面的例子
三.方便JS等客户端脚本,如果在页面中要对某个对象进行脚本操作,那么可以给他定义一个ID,否则只能利用遍历页面元素加上指定特定属性来找到它,这是相对浪费时间资源,远远不如一个ID来得简单.
11.如何垂直居中文本
将元素高度和行高设为一致。
- <style type="text/css">
- <!--
- div{
- height:30px;
- line-height:30px;
- border:1px solid red
- }
- -->
- </style>
12.如何对齐文本与文本输入框
加上 vertical-align:middle;
- <style type="text/css">
- <!--
- input {
- width:200px;
- height:30px;
- border:1px solid red;
- vertical-align:middle;
- }
- -->
- </style>
13.FF下面不能水平居中呢
FF下面设置容器的左右外补丁为auto就可以了
- <style type="text/css">
- <!--
- div{
- margin:0 auto;
- }
- -->
- </style>
14.FF下文本无法撑开容器的高度
标准浏览器中固定高度值的容器是不会象IE6里那样被撑开的,那我又想固定高度,又想能被撑开需要怎样设置呢?办法就是去掉height设置min-height:200px; 这里为了照顾不认识min-height的IE6 可以这样定义:
- {
- height:auto!important;
- height:200px;
- min-height:200px;
- }
15.IE6下容器的宽度和FF解释不同呢
- <?xml version="1.0" encoding="gb2312"?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
- <style type="text/css">
- <!--
- div{
- cursor:pointer;
- width:200px;
- height:200px;
- border:10px solid red
- }
- -->
- </style>
- <div ōnclick="alert(this.offsetWidth)">web标准常见问题大全</div>
问题的差别在于容器的整体宽度有没有将边框(border)的宽度算在其内,这里IE6解释为200PX ,而FF则解释为220PX,那究竟是怎么导致的问题呢?大家把容器顶部的xml去掉就会发现原来问题出在这,顶部的申明触发了IE的qurks mode,关于qurks mode、standards mode的相关知识,请参考:
http://www.microsoft.com/..
16. 为什么web标准中IE无法设置滚动条颜色了
解决办法是将body换成html
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
- <style type="text/css">
- <!--
- html {
- scrollbar-face-color:#f6f6f6;
- scrollbar-highlight-color:#fff;
- scrollbar-shadow-color:#eeeeee;
- scrollbar-3dlight-color:#eeeeee;
- scrollbar-arrow-color:#000;
- scrollbar-track-color:#fff;
- scrollbar-darkshadow-color:#fff;
- }
- -->
- </style>
17. 为什么我定义的样式没有作用呢
这里你无法用.aa定义到li 遇到这种情况怎么解决呢?答案是提高.aa 的优先权 比如#aa ul li.aa
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
- <style type="text/css">
- <!--
- #aa ul li {
- color:red
- }
- .aa {
- color:blue
- }
- -->
- </style>
- <div id="aa">
- <ul>
- <li class="aa">
- web标准常见问题大全
- </li>
- </ul>
- </div>
18. IE6无法定义1px左右高度的容器
IE6下这个问题是因为默认的行高造成的,解决的方法也有很多,例如:
- overflow:hidden zoom:0.08 line-height:1px
19. 背景颜色无法显示
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
- <style type="text/css">
- <!--
- ul {
- background:red
- }
- li {
- float:left;
- width:180px;
- }
- -->
- </style>
- <!--[if lte IE 6]>
- <style>
- .gainlayout { height: 1px; }
- </style>
- <![endif]-->
- <ul class="gainlayout">
- <li>web标准常见问题大全</li>
- <li>web标准常见问题大全</li>
- <li>web标准常见问题大全</li>
- <li>web标准常见问题大全</li>
- <li>web标准常见问题大全</li>
- <div style="clear:both"></div>
- </ul>
IE中设置有背景色的ul并没有显示出来,这个属于haslayout问题,解决的办法也很多参考http://www.satzansatz.de/cssd/onhavinglayout.htm
解决方法之一:
- <!--[if lte IE 6]>
- <style>
- .gainlayout { height: 1px; }
- </style>
- <![endif]-->
- <!--[if lte IE 6]>
- <style>
- .gainlayout { height: 1px; }
- </style>
- <![endif]-->
20. 怎么样才能让层显示在FLASH之上呢
解决的办法是给FLASH设置透明
- <param name="wmode" value="transparent" />
21. 怎样使一个层垂直居中于浏览器中
这里我们使用百分比绝对定位,与外补丁负值的方法,负值的大小为其自身宽度高度除以二
- <style type="text/css">
- <!--
- div {
- position:absolute;
- top:50%;
- left:50%;
- margin:-100px 0 0 -100px;
- width:200px;
- height:200px;
- border:1px solid red;
- }
- -->
- </style>
22. 图片垂直与容器内
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <style type="text/css">
- <!--
- * {margin:0;padding:0}
- div {
- width:500px;
- height:500px;
- border:1px solid #ccc;
- overflow:hidden;
- position:relative;
- display:table-cell;
- text-align:center;
- vertical-align:middle
- }
- div p {
- position:static;
- +position:absolute;
- top:50%
- }
- img {
- position:static;
- +position:relative;
- top:-50%;left:-50%;
- width:276px;
- height:110px
- }
- -->
- </style>
- <div><p><img src="logo.gif" /></p></div>
或者使用背景图的办法:
- background:url("logo.gif") center no-repeat;
23. 如何让div横向排列
横向排列DIV可以使用浮动的方式比如float:left,或者设置对象为内联,还可以绝对定位对象等等.
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
- <style type="text/css">
- <!--
- div {
- float:left;
- width:200px;
- height:200px;
- border:1px solid red
- }
- -->
- </style>
- <div>web标准常见问题大全</div>
- <div>web标准常见问题大全</div>
- <div>web标准常见问题大全</div>
24 Firefox 关于DIV高度无法自适应的两种解决
如果设置了一个DIV的高度,当DIV里实际内容大于所设高度,ie会自动拉伸以适应DIV容器大小,ff会固定DIV的高度,超过部分超出DIV底线以外,
出现和下面的内容重叠的现象。如果不给DIV设置高度,在Firefox中将不回因为里面的内容而撑开,而IE中就会自动根据内容撑开
解决方案:
1、在DIV内部的最后追加clear:both样式
- <div style="background-color:#FF0000;">
- <div style="float:left; height:200px">Jmedia Design</div>
- <div style="float:right; height:800px">www.jmedia.cn</div>
- <div style="clear:both"></div>
- </div>
2、对DIV使用overflow:auto;
- <div style="overflow:auto;">
- <div style="float:left; background-color:#000000;height:200px">1111111111</div>
- <div style="float:right;background-color:#000000; height:300px"">2222222222</div>
- </div>
发表评论
-
javascript绘制图形
2011-10-27 16:27 1355使用javascript绘制图形,在html5中 ... -
html 如何让一个块级元素居中
2011-08-14 11:47 1959载自 http://www.aa25.cn/div_css/8 ... -
html css中的一些元素的默认属性
2011-08-13 18:55 1820html css布局之类的问题真的让人很头疼 ... -
div css 左列固定,右列宽度自适应
2011-08-13 17:36 1645转载的,发现跟我以前所理解大不一样,原文http://www. ... -
css z-index
2011-02-24 12:05 1131为什么它会产生混乱? 即使Z-index并不是一个难以 ...
相关推荐
CSS在firefox和ie下的兼容性问题,是最让网页设计师头痛的事。在IE下测试明明是正常的,到了火狐下就变样了。这样一来还得重新修改,最怕改好后在IE下又不兼容了。这里介绍一下css在火狐和ie下的兼容要点。
总结了一些常用属性在ie和firefox下的兼容问题,并附有相应的解决方法。
IE和Firefox的Javascript兼容性总结
Firefox与IE浏览器的javascript兼容性问题Firefox与IE浏览器的javascript兼容性问题Firefox与IE浏览器的javascript兼容性问题Firefox与IE浏览器的javascript兼容性问题Firefox与IE浏览器的javascript兼容性问题Fire...
Javascript的IE和Firefox(火狐)兼容性解决方案
IE和FIREFOX的JAVASCRIPT兼容性总结.pdf
IE和Firefox的Javascript兼容性总结终版.pdf
Firefox和IE兼容参考,这是前段时间为把公司的框架兼容Firefox而作的总结,供参考
IE和Firefox的Javascript兼容性总结[定义].pdf
IE6、_IE7、IE8、Firefox兼容性问题IE6、_IE7、IE8、Firefox兼容性问题IE6、_IE7、IE8、Firefox兼容性问题IE6、_IE7、IE8、Firefox兼容性问题
css在firefox IE的兼容性(案例分析及解决方案) 12个常见 兼容性小例子(html文件附说明)
最让页面设计师头痛的就是兼容问题,你想知道ie和火狐一起兼容吗,来学习一下吧
JS的IE和Firefox兼容性总结
利用!important来处理margin在firefox与IE的显示差别
这份文档详细描述了IE和Firefox两大浏览器对js的兼容性处理
这是一个对IE和火狐的兼容性测试网页,对于兼容性把握不好的朋友们,希望这个网页可以帮到你们!
CSS对浏览器器的兼容性具有很高的价值,通常情况下IE和Firefox存在很大的解析差异,这里介绍一下兼容要点。
本文总结分析了Javascript在IE和Firefox浏览器常见兼容性问题。分享给大家供大家参考,具体如下: 表单 document.formName.item("itemName") IE:可以使用document.formName.item(“itemName”)或document.formName...
解决现有IE和firefox不兼容的问题,内有多种解决方法,请大家好好学习
Javascript的IE和Firefox兼容性问题集合