Why border of not showing in IE?

前端 未结 3 1405
南方客
南方客 2020-12-11 08:23

Why border of tfoot tr:first-child not showing in IE. I\'m checking in IE7.

font-weight:bold; background:yellow is showing in IE but border

3条回答
  •  没有蜡笔的小新
    2020-12-11 08:49

    I would avoid styling tr elements because they don't really "exist" as such, apart from for semantic reasons. You're better off targeting the table cells themselves, with something like this:

    table tfoot tr:first-child th,
    table tfoot tr:first-child td {
        font-weight:bold;
        background:yellow;
        border-top:2px solid red; 
        border-bottom:2px solid red;
    }
    

    Also, since you are targeting directly nested elements, you can use the child selector, which is faster for browsers to parse (they only have to search one level up/down).

    table > tfoot > tr:first-child > th,
    table > tfoot > tr:first-child > td {
        ...
    }
    

提交回复
热议问题