CSS Cell Margin

后端 未结 16 1279
长情又很酷
长情又很酷 2020-11-29 02:18

In my HTML document, I have a table with two columns and multiple rows. How can I increase the space in between the first and second column with css? I\'ve tried applying \"

16条回答
  •  粉色の甜心
    2020-11-29 03:09

    If padding isn't working for you, another work around is to add extra columns and set a margin via width using . None of the padding solutions above were working for me as I was trying to give the cell border itself a margin, and this is what solved the problem in the end:

    data more data

    Style the borders of the table cells using :nth-child so that the 2nd and third columns appear to be a single column.

    table tr td:nth-child(2) { border: 1px solid black; border-right:0; }
    table tr td:nth-child(3) { border: 1px solid black; border-left:0; }
    

提交回复
热议问题