table的border颜色问题

发布于 2022-09-01 06:37:03 字数 1421 浏览 11 评论 0

在看W3C关于table的文档时,看到

The following rules determine which border style "wins" in case of a conflict:

  • Borders with the 'border-style' of 'hidden' take precedence over all other conflicting borders. Any border with this value suppresses all borders at this location.

  • Borders with a style of 'none' have the lowest priority. Only if the border properties of all the elements meeting at this edge are 'none' will the border be omitted (but note that 'none' is the default value for the border style.)

  • If none of the styles are 'hidden' and at least one of them is not 'none', then narrow borders are discarded in favor of wider ones. If several have the same 'border-width' then styles are preferred in this order: 'double', 'solid', 'dashed', 'dotted', 'ridge', 'outset', 'groove', and the lowest: 'inset'.

  • If border styles differ only in color, then a style set on a cell wins over one on a row, which wins over a row group, column, column group and, lastly, table. When two elements of the same type conflict, then the one further to the left (if the table's 'direction' is 'ltr'; right, if it is 'rtl') and further to the top wins.
  • 在最后一点中说到,如果border style只在颜色上有区别,那么右下角的优先级更高。
    但是测试下来的结果并不是这样:table的border颜色测试

    为虾米呢?哪位大侠出来解答一下~

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

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

    发布评论

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

    评论(1

    神妖 2022-09-08 06:37:03

    我虽然也不是很懂这个,但是从结果看,的确是右侧和下侧的优先级最高呀,因为你看每当有重叠的时候,唯独是右侧和下侧去覆盖别人,从来没有被覆盖过~

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