table的border颜色问题


在看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颜色测试

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

    border table

    lzhpal 10 years, 1 month ago

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

    春哥教信徒 answered 10 years, 1 month ago

    Your Answer