How do you specify table padding in CSS? ( table, not cell padding )

前端 未结 12 1323
我在风中等你
我在风中等你 2020-12-15 02:18

I have a table with a colored background and I need to specify the padding between the table and it\'s content, I.E. cells.
The table tag doesn\'t seem to accept a paddi

12条回答
  •  独厮守ぢ
    2020-12-15 02:56

    table.foobar
    {
       padding:30px; /* if border is not collapsed */
    }
    
    or 
    
    table.foobar
    {
       border-spacing:0;
    }
    table.foobar>tbody
    {
       display:table;
       border-spacing:0; /* or other preferred */
       border:30px solid transparent; /* 30px is the "padding" */
    }
    

    Works in Firefox, Chrome, IE11, Edge.

提交回复
热议问题