Set cellpadding and cellspacing in CSS?

前端 未结 28 1079
暖寄归人
暖寄归人 2020-11-22 02:15

In an HTML table, the cellpadding and cellspacing can be set like this:

28条回答
  •  囚心锁ツ
    2020-11-22 02:16

    Simply use CSS padding rules with table data:

    td { 
        padding: 20px;
    }
    

    And for border spacing:

    table { 
        border-spacing: 1px;
        border-collapse: collapse;
    }
    

    However, it can create problems in older version of browsers like Internet Explorer because of the diff implementation of the box model.

提交回复
热议问题