您的位置:首页 > 其它

firefox下rowspan+border+border-collapse的bug

2010-02-08 07:33 1071 查看
后查具体情况概述为:firefox+table rowspan+border+border-collapse:collapse;
表现情况是:第一行与最后一行正常,其余的中间行,全部都与预期的border不同。
先看示例吧:
Rank's HTML document

* {font-size:15px;text-decoration:none;}
td {border-top:1px solid #000}

第一列 第二列
test 第一条中间没有横线
test
test 可爱的firefox让我们看到了两条线
test
test 可爱的firefox让我们看到了两条线
test
test 可爱的firefox让我们看到了两条线
test
test 最后一条中间没有横线
test

经过验证,两种解决方法。
去除border-collapse
加上一个border-left或者border-right
无独有偶,后来搜索了一下,也有前人踩到了这个坑里,它的解决方法也是:border-left:1px solid #999 important;border-left:none的方法来解决。
(see detail:http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/CSS/Q_23698654.html)
好在可以通过border的错觉及颜色来解决这个问题。为了偷懒,我直接用上了对方的e.g。看解决前的代码:
table {
border-collapse:collapse;
}
th, td {
border: 1px black solid;
}
th {
background-color: #A9AE7B;
}
td.right_user_img {

border-left:none;
background-color: #999999;
text-align: center;
padding: 15px;
}

td.left_user_img {
border-right: none;
background-color: #CCCCCC;
text-align: center;
padding: 15px;
}
td.left_image_join {
background-color: #CCCCCC;
border-left: none;
}
td.right_image_join {
background-color: #999999;
border-right: none;
}
img {
border: none;
}

Image Insert Heading Here Image
1 Data
2 Data
3 Data
4 Data
5 Data
6 Data
7 Data
8 Data
9 Data
10 Data

解决后的代码:
table {
border-collapse:collapse;
}
th, td {
border: 1px black solid;
}
th {
background-color: #A9AE7B;
}
td.right_user_img {
border-left:1px solid #999999 !important; /*this solves border-collapse/rowspan bug in firefox 3 */
border-left:none;
background-color: #999999;
text-align: center;
padding: 15px;
}

td.left_user_img {
border-right: none;
background-color: #CCCCCC;
text-align: center;
padding: 15px;
}
td.left_image_join {
background-color: #CCCCCC;
border-left: none;
}
td.right_image_join {
background-color: #999999;
border-right: none;
}
img {
border: none;
}

Image Insert Heading Here Image
1 Data
2 Data
3 Data
4 Data
5 Data
6 Data
7 Data
8 Data
9 Data
10 Data

PS.好象firefox 一直以来就有这个bug。问多久前有的?至少flock就有了
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息