我的 last question在我得到完整答案之前已经关闭,所以我将以不同的方式分阶段进行。
在 Chrome 中,如果您在一个表格单元格上设置边框底部,您必须在同一行中的所有单元格上设置边框底部,否则 Chrome 不知道如何处理未计算的空间.
It was suggested我只是使用白色边框使其看起来好像其他单元格没有边框。但是,如果我有一个渐变背景,并且不想出现白线怎么办?
看来 1px solid transparent
没有任何影响。 rgba
也不起作用。
最佳答案
根据 MDN这一切都归结为 border-collapse
属性:
The separated model is the traditional HTML table border model. Adjacent cells each have their own distinct borders. The distance between them given by the border-spacing property.
In the collapsed border model, adjacent table cells share borders. In that model, the border-style value of inset behaves like groove, and outset behaves like ridge.
将 border-collapse
更改为 separate,效果很好: jsFiddle example
关于html - 如何为 Chrome 中的表格单元格添加透明边框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16245110/