How to get css background color on tag to span entire row

前端 未结 8 1669
旧时难觅i
旧时难觅i 2020-12-24 04:53

I have tried everything I can think of in css in order to get a background color to span an entire table row ( tag) But I keep getting a white border around each

8条回答
  •  被撕碎了的回忆
    2020-12-24 05:45

    I prefer to use border-spacing as it allows more flexibility. For instance, you could do

    table {
      border-spacing: 0 2px;
    }
    

    Which would only collapse the vertical borders and leave the horizontal ones in tact, which is what it sounds like the OP was actually looking for.

    Note that border-spacing: 0 is not the same as border-collapse: collapse. You will need to use the latter if you want to add your own border to a tr as seen here.

提交回复
热议问题