基于 Gecko 的浏览器中 CSS 表格单元格边框消失

发布于 2024-07-07 17:52:02 字数 1919 浏览 9 评论 0原文

我有一个非常具体的 html 表结构,似乎揭示了 Gecko 错误。

这是问题的精炼版本。 在基于 gecko 的浏览器(例如 FF)中观察下表:(您必须将其复制并粘贴到新文件中)

<style>
table.example{
    border-collapse:collapse;
}
table.example td {
    border:1px solid red;
}
</style>
<table class="example">
    <thead>
        <tr>
            <th>1</th>
            <th>2</th>
            <th>3</th>          
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>1</td>
            <td>2</td>
            <td rowspan="3">3</td>

        </tr>
        <tr>
            <td>1</td>
            <td>2</td>
        </tr>
        <tr>
            <td>1</td>
            <td rowspan="2">2</td>      
        </tr>
        <tr>
            <td>1</td>
            <td>3</td>
        </tr>
    </tbody>
</table>

右下角单元格中的“3”上方缺少一行 -- view在任何其他浏览器中,该行都会按预期显示。 有趣的是,丢掉表格的标题部分,看看我们得到了什么:

<style>
table.example{
    border-collapse:collapse;
}
table.example td {
    border:1px solid red;
}
</style>
<table class="example">
    <tbody>
        <tr>
            <td>1</td>
            <td>2</td>
            <td rowspan="3">3</td>

        </tr>
        <tr>
            <td>1</td>
            <td>2</td>
        </tr>
        <tr>
            <td>1</td>
            <td rowspan="2">2</td>      
        </tr>
        <tr>
            <td>1</td>
            <td>3</td>
        </tr>
    </tbody>
</table>

这样做就可以了。 有人见过这个吗? 我想我现在将删除我的 thead 部分作为一种解决方法,尽管它使表格更难以访问。

I have a very specific html table construct that seems to reveal a Gecko bug.

Here's a distilled version of the problem. Observe the following table in a gecko-based browser (FF, for example): (you'll have to copy and paste this into a new file)

<style>
table.example{
    border-collapse:collapse;
}
table.example td {
    border:1px solid red;
}
</style>
<table class="example">
    <thead>
        <tr>
            <th>1</th>
            <th>2</th>
            <th>3</th>          
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>1</td>
            <td>2</td>
            <td rowspan="3">3</td>

        </tr>
        <tr>
            <td>1</td>
            <td>2</td>
        </tr>
        <tr>
            <td>1</td>
            <td rowspan="2">2</td>      
        </tr>
        <tr>
            <td>1</td>
            <td>3</td>
        </tr>
    </tbody>
</table>

There's a line missing over the "3" in the bottom-right cell -- view it in any other browser and the line will appear as expected. Interestingly, ditch the thead section of the table and look what we get:

<style>
table.example{
    border-collapse:collapse;
}
table.example td {
    border:1px solid red;
}
</style>
<table class="example">
    <tbody>
        <tr>
            <td>1</td>
            <td>2</td>
            <td rowspan="3">3</td>

        </tr>
        <tr>
            <td>1</td>
            <td>2</td>
        </tr>
        <tr>
            <td>1</td>
            <td rowspan="2">2</td>      
        </tr>
        <tr>
            <td>1</td>
            <td>3</td>
        </tr>
    </tbody>
</table>

Doing that makes it work. Has anyone seen this? I suppose I'll just get rid of my thead section for now as a workaround though it makes the table rather less accessible.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

九厘米的零° 2024-07-14 17:52:03

我也发现了这个错误,但它不在我的电脑上,而是在另一台电脑上。 如果我在达到一定分辨率后调整浏览器窗口的大小,这些线条就会消失。 一旦我最大化窗口,所有内容都会弹出。
您可以通过设置 border-collapse:separate; 永久修复此问题 这为每个单元格的每个钻孔提供了自己的宽度。 这不是我想做的,但它有效。

也可能是由于使用 border-collapse:collapse; 引起的 然后将对齐边框设置为 1px,然后设置为 0px。 因为它折叠了边框,所以似乎优先考虑 0px 宽度而不是 1px 宽度。

不管怎样,它只是 Firefox,这也是放弃它的另一个原因。

i have also found this bug but it's not on my PC but another. If i resize the browser window after a certain resolution the lines will disappear. once i maximise the window the all pop back.
you can fix this permanently by setting border-collapse:separate; this gives each boreder of each cell its own width. It's not what i want to do but it works.

It can also be caused by using border-collapse:collapse; then setting aligning borders to 1px and then 0px. Because it collapses the borders it seems to prioritise the 0px over the 1px width.

either way it's firefox only and it's yet another reason to move away from it.

舞袖。长 2024-07-14 17:52:02

奇怪……绝对是绘画错误。 如果您右键单击以使上下文菜单出现在线条应在的位置的部分上方,那么当您关闭上下文菜单时,线条将在下面重新绘制。

编辑:解决方法 - 如果将 style="border-color: ...;" 放在 上,您可以获得边框出现,但它必须是不同的颜色 - 只需使用尽可能接近其他颜色的颜色即可。 例如,如果表是#ff0000,则使用#ff0001

Strange... definitely a painting bug. If you right-click to get the context menu to appear over part of where the line should be, then when you dismiss the context menu, the line has been redrawn underneath.

Edit: Workaround - if you put style="border-color: ...;" on the <td rowspan="3"> you can get the border to appear, but it has to be a different colour - just use one that's as close to the others as possible. For example, if the table is #ff0000 use #ff0001

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文