Firefox下table-layout:fixed无效问题
时间:2010-09-21
来源:互联网
测试代码如下:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; UTF-8">
<title>任务进度新Gantt图(周-日)</title>
<style type="text/css">
.scrollColThead {
position: relative;
z-index: 2;
}
.scrollColThead th{
text-align: center ;
font-size: 12px;
border-bottom: 1px solid #4D7A9F;
border-right: 1px solid #4D7A9F;
}
</style>
</head>
<body>
<table border="0" cellspacing="0" cellpadding="0" style="table-layout:fixed">
<thead>
<tr class="scrollColThead" style="background-color:#A5BBCD;text-align:center;height:20px;">
<th style="background-color:#DDDDDD;text-align:center;width:20px;" title="2009-12-06">日</th>
<th style="width:20px;" title="2009-12-07">一</th>
<th style="width:20px;" title="2009-12-08">二</th>
<th style="width:20px;" title="2009-12-09">三</th>
<th style="width:20px;" title="2009-12-10">四</th>
<th style="width:20px;" title="2009-12-11">五</th>
<th style="background-color:#DDDDDD;text-align:center;width:20px;" title="2009-12-12">六</th>
</tr>
</thead>
</table>
</body>
</html>
在IE6和Firefox3.6.8下测试发现整个表头行的宽度不相等,相差几个像素。当去除style="table-layout:fixed"时,在两个浏览器下行宽度是相等的!所以,推断是table-layout:fixed在Firefox下无效引起的,请问大家有没有其他的看法和解决方案,另, Firefox下有替代CSS expression方案 吗?请多指教 !谢谢!
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; UTF-8">
<title>任务进度新Gantt图(周-日)</title>
<style type="text/css">
.scrollColThead {
position: relative;
z-index: 2;
}
.scrollColThead th{
text-align: center ;
font-size: 12px;
border-bottom: 1px solid #4D7A9F;
border-right: 1px solid #4D7A9F;
}
</style>
</head>
<body>
<table border="0" cellspacing="0" cellpadding="0" style="table-layout:fixed">
<thead>
<tr class="scrollColThead" style="background-color:#A5BBCD;text-align:center;height:20px;">
<th style="background-color:#DDDDDD;text-align:center;width:20px;" title="2009-12-06">日</th>
<th style="width:20px;" title="2009-12-07">一</th>
<th style="width:20px;" title="2009-12-08">二</th>
<th style="width:20px;" title="2009-12-09">三</th>
<th style="width:20px;" title="2009-12-10">四</th>
<th style="width:20px;" title="2009-12-11">五</th>
<th style="background-color:#DDDDDD;text-align:center;width:20px;" title="2009-12-12">六</th>
</tr>
</thead>
</table>
</body>
</html>
在IE6和Firefox3.6.8下测试发现整个表头行的宽度不相等,相差几个像素。当去除style="table-layout:fixed"时,在两个浏览器下行宽度是相等的!所以,推断是table-layout:fixed在Firefox下无效引起的,请问大家有没有其他的看法和解决方案,另, Firefox下有替代CSS expression方案 吗?请多指教 !谢谢!
作者: langxianfa 发布时间: 2010-09-21
请明确设置 width!
CSS 2.1规范:17.5.2.1 Fixed table layout
The table's width may be specified explicitly with the 'width' property. A value of 'auto' (for both 'display: table' and 'display: inline-table') means use the automatic table layout algorithm.
CSS 2.1规范:17.5.2.1 Fixed table layout
The table's width may be specified explicitly with the 'width' property. A value of 'auto' (for both 'display: table' and 'display: inline-table') means use the automatic table layout algorithm.
作者: mochimo 发布时间: 2010-09-21
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28