当前位置: 网站建设 > 网页设计 > 建站经验 >

div+CSS 兼容小摘

时间:2013-03-02 03:47来源:未知 作者:admin 点击:

标签:div+CSS 兼容小摘 小摘(1)网站建设(1202)兼容(37)DIV+CSS(51)
--> [网站建设之]div+CSS 兼容小摘 区别IE6与FF: background:orange;*background:blue; 区别IE6与IE7: background:green !important;background:blue, DIV+CSS 全屏垂直居中的一个办法 ; 区别IE7与FF: background:orange; *background:green; 差别FF,IE7
div+CSS 兼容小摘》文章地址:http://www.tfxk.com/wangyesheji/jianzhanjingyan/03023350H013.htm
--> [网站建设之]div+CSS 兼容小摘

区别IE6与FF:
background:orange;*background:blue;
区别IE6与IE7:
background:green !important;background:blue,DIV+CSS 全屏垂直居中的一个办法;
区别IE7与FF:
background:orange; *background:green;
差别FF,IE7,IE6:
background:orange;*background:green !important;*background:blue;
IE7,IE8兼容:
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
HEAD
1. CSS中多少种阅读器对不同要害字的支持,可进行浏览器兼容性反复定义
!important 可被FireFox和IE7辨认
* 可被IE6、IE7识别
_ 可被IE6识别
*+ 可被IE7识别
2. IE专用的前提解释
<!--其余浏览器 -->
<link rel="stylesheet" type="text/css" href="css.css" />
<!--[if IE 7]>
<!-- 适合于IE7 -->
<link rel="stylesheet" type="text/css" href="ie7.css" />
<![endif]-->
<,div 实现长英文字母自动换行CSS;!--[if lte IE 6]>
<!-- 合适于IE6及一下 -->
<link rel="stylesheet" type="text/css" href="ie.css" />
<![endif]-->
3. 几个浏览器对实际像素的说明
IE/Opera:对象的实际宽度 = (margin-left) + width + (margin-right)
Firefox/Mozilla:对象的实际宽度= (margin-left) + (border-left-width) + (padding- left) + width + (padding-right) + (border-right-width) + (margin-right)
4. 鼠标手势问题:FireFox的cursor属性不支持hand,div css表单布局的五个小技巧,然而支撑pointer,IE两个都支持;所认为了兼容都用pointer
5. FireFox中设置HTML标签的Style属性时,所有地位、宽高和尺寸值必须后跟px,DIV CSS网页布局中常用的列表元素ul ol li dl dt dd释义,IE也支持此写法,因而同一加px单位。如 Obj.Style.Height = imgObj.Style.Height + ‘px';
6. FireFox无奈解析简写的padding属性设置,如padding 5px 4px 3px 1px;必需改为 padding-top:5px; padding-right:4px; padding-bottom:3px; padding-left:1px0;
7. 打消ul、ol等列表的缩进时,样式应写成:list-style:none;margin:0px;padding:0px;其中margin属性对IE有效,padding属性对FireFox有效
8. CSS把持透明:IE:filter:progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=60),DIV CSS样式在SEO中的命名规则; FireFox:opacity:0.6;
9. CSS节制圆角:IE:不支持圆角,DIV CSS布局中如何组织样式表以便于简化、维护
FireFox: -moz-border-radius:4px;或
-moz-border-radius-topleft:4px;
-moz-border-radius-topright:4px;
-moz-border-radius-bottomleft:4px;
-moz-border-radius- bottomright:4px;
10. CSS双线凹凸边框:IE:border:2px outset;
FireFox:
-moz-border-top-colors: #d4d0c8 white;
-moz-border-left-colors: #d4d0c8 white;
-moz-border-right-colors:#404040 #808080;
-moz-border-bottom-colors:#404040 #808080;
11. IE支持CSS方式cursor:url()自定义光标款式文件和转动条色彩作风;FireFox对以上两者均不支持
12. IE有Select控件永远处于最上层的bug,且所有CSS对Select控件都不起作用
13. IE支持Form中的Label标签,包含图片和文字内容;FireFox不支持包括图片的Label,DIV CSS列形导航示例,点击图片不能让标志 label for 的Radio或CheckBox发生后果
14. FireFox中的TextArea不支持onScroll事件
15. FireFox不支持display的inline和block
16. FireFox对Div设置margin-left, margin-right为auto时已经居中, IE中不行
17. FireFox对Body设置text-align时, Div须要设置margin: auto(重要是margin-left margin-right) 方可居中
18. 对超链接的CSS样式设置最好服从这样的次序:L-V-H-A。即
<,display inline-block的应用两例;style type="text/css">
<!--
a:link {}
a:visited {}
a:hover {}
a:active {}
-->
</style>,Discuz!NT静态文件缓存(SQUID)解决方案;
这样能够防止一些拜访过后的超链接就不具备hover和active样式了
19. IE中设置长段落自动换行在CSS中设置word-wrap:break-word;FireFox中应用JS插入 的办法来实现,详细代码如下:
<script type="text/javascript">
/* <![CDATA[ */
function toBreakWord(el, intLen){
var obj=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("div_id", 37);
/* ]]> */
</script>
20. 在子容器加了浮动属性后,该容器将不能主动撑开
解决方法:在标签停止后下一个标签中加上一个肃清浮动的CSS clear:both;
21. 浮动后IE6解释外边距为实际边距的双倍
解决方法:加上display:inline
22. IE6下图片下方会有空隙
解决办法:为img加上display:block或设置vertical-align 属性为vertical-align:top | bottom |middle |text-bottom
23. IE6下两个层旁边有缝隙
解决措施:设置右侧div也同样浮动float:left或者绝对IE6定义 margin-right:-3px;
24. LI中内容超过长度后以省略号的显示方法
<style type="text/css">
<!--
li {
width:200px;
white-space:nowrap;
text-overflow:ellipsis;
-o-text-overflow:ellipsis;
overflow: hidden;
}
-->
</style>
25. 将元素的高度跟行高设为雷同值,即可垂直居中文本
<style type="text/css",Discuz!NT论坛数据库读写分离方案;>
<!--
div {
height:30px;
line-height:30px;
}
-->
</style>
26. 对齐文本与文本输入框,须在CSS中增添vertical-align:middle;属性设置
<style type="text/css">
<!--
… …
vertical-align:middle;
}
-->
</style>
Tag:Div+CSS   Div+CSS  

div+CSS兼容小摘,比拟适用的小技能。


(责任编辑:网站建设)
div+CSS 兼容小摘相关文章
上一篇:DIV+CSS 全屏垂直居中的一个办法 下一篇:DIV+css初学者需要引起重视的10个问题与技巧
回到顶部