Border around specific rows in a table?

后端 未结 10 1574
轮回少年
轮回少年 2020-12-02 08:10

I\'m trying to design some HTML/CSS that can put a border around specific rows in a table. Yes, I know I\'m not really supposed to use tables for layout but I don\'t know en

10条回答
  •  Happy的楠姐
    2020-12-02 08:48

    Thank you to all that have responded! I've tried all of the solutions presented here and I've done more searching on the internet for other possible solutions, and I think I've found one that's promising:

    tr.top td {
      border-top: thin solid black;
    }
    
    tr.bottom td {
      border-bottom: thin solid black;
    }
    
    tr.row td:first-child {
      border-left: thin solid black;
    }
    
    tr.row td:last-child {
      border-right: thin solid black;
    }
    
    
    
    
    
    
    
      
    no border no border here either
    one two
    three four
    once again no borders
    hello
    world

    Output:

    enter image description here

    Instead of having to add the top, bottom, left, and right classes to every , all I have to do is add top row to the top , bottom row to the bottom , and row to every in between. Is there anything wrong with this solution? Are there any cross-platform issues I should be aware of?

提交回复
热议问题