博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Border Collapse differences in FF and Webkit
阅读量:4697 次
发布时间:2019-06-09

本文共 1678 字,大约阅读时间需要 5 分钟。

What you're seeing is the difference in how Firefox and Chrome treat 
border-collapse
. While both browsers render the desired result correctly, their methodology for calculating it differs slightly.

Firefox reads it thusly:

  • the <table> itself has border-top-width: 1px and border-left-width: 1px
  • each contained <td> has border-right-width: 1px and border-bottom-width: 1px

Chrome reads each <td> as having its own border all the way around.

In essence, when it sees border-collapse, Firefox revises the properties of each cell in order to remove borders - whereas Chrome keeps the values and just overlaps each border. The effect is the same, just different values at the <td> level. In both browsers, a <td>'s border will lay on top of the<td> preceding it (either above or to the left). Firefox adds a 1px border to the bottom of the cell above (for border-top) and 1px to the right of the cell to the left (for border-right) or to the table if there is no cell to the top or left.

Whilst this may not be noticle for tables rendered only at page load, for dynamically changing tables like hiding / showing a row which has a border this is noticable because it changes the height of the cell above or the width of the cell to the left by -1px (due to the way td heights and widths are calculated) and therefore causes noticable resizing from the original.

There should be a standard way of calculating these, and unfortunately for dynamic tables, the firefox method doesn't really work. It renders the border-collapse option useless.

To overcome these, remove border-collapse and add border-spacing: 0.

转载于:https://www.cnblogs.com/cnwebdeveloper/archive/2011/12/27/2302728.html

你可能感兴趣的文章
第二冲刺阶段个人博客5
查看>>
UVA 116 Unidirectional TSP (白书dp)
查看>>
第三方测速工具
查看>>
MySQL 网络访问连接
查看>>
在aws ec2上使用root用户登录
查看>>
数据访问 投票习题
查看>>
cnblog!i'm coming!
查看>>
使用点符号代替溢出的文本
查看>>
Axios 中文说明
查看>>
fatal: remote origin already exists.
查看>>
gridview 自定义value值
查看>>
2018二月实现计划成果及其三月规划
查看>>
类名.class和getClass()区别
查看>>
12/17面试题
查看>>
LeetCode 242. Valid Anagram
查看>>
JSP表单提交乱码
查看>>
如何适应现代雇佣关系
查看>>
团队项目(第五周)
查看>>
SQL 优化经验总结34条
查看>>
开源 视频会议 收藏
查看>>