css FF与IE兼容性总结( 二 )


Code:
style type=text/css
!--
div{
margin:0 auto;
}
--
/style
14.FF下文本无法撑开容器的高度
标准浏览器中固定高度值的容器是不会象IE6里那样被撑开的,那我又想固定高度,又想能被撑开需要怎样设置呢?办法就是去掉height设置min-height:200px; 这里为了照顾不认识min-height的IE6 可以这样定义:
Code:
{
height:auto!important;
height:200px;
min-height:200px;
}
15.IE6下容器的宽度和FF解释不同呢
Code:
?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的相关知识,请参考:
[url]http://www.microsoft.com/china/msdn/library/webservices/asp.net/
ASPNETusStan.mspx?mfr=true[/url]
16. 为什么web标准中IE无法设置滚动条颜色了
解决办法是将body换成html
Code:
!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
Code:
!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. 背景颜色无法显示
Code:
!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
liweb标准常见问题大全/li
liweb标准常见问题大全/li
liweb标准常见问题大全/li
liweb标准常见问题大全/li
liweb标准常见问题大全/li
div style=clear:both/div
/ul
IE中设置有背景色的ul并没有显示出来,这个属于haslayout问题,解决的办法也很多参考 http://www.satzansatz.de/cssd/onhavinglayout.htm
解决方法之一:
Code:
!--[if lte IE 6]
style
.gainlayout { height: 1px; }
/style
![endif]--
!--[if lte IE 6]
style
.gainlayout { height: 1px; }
/style
![endif]--
20. 怎么样才能让层显示在FLASH之上呢
解决的办法是给FLASH设置透明
Code:
param name=wmode value=https://www.rkxy.com.cn/dnjc/transparent /
21. 怎样使一个层垂直居中于浏览器中
这里我们使用百分比绝对定位,与外补丁负值的方法,负值的大小为其自身宽度高度除以二