Set cellpadding and cellspacing in CSS?

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

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

28条回答
  •  借酒劲吻你
    2020-11-22 02:24

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

    For cell-padding:

    Just call simple td/th cell padding.

    Example:

    /******Call-Padding**********/
    
    table {
        border-collapse: collapse;
    }
    
    td {
      border: 1px solid red;
      padding: 10px;
    }
Head1 Head2 Head3 Head4
11 12 13 14
21 22 23 24
31 32 33 34
41 42 43 44

table {
    border-collapse: collapse;
}

td {
  border: 1px solid red;
  padding: 10px;
}

For cell-spacing

Just call simple table border-spacing

Example:

/********* Cell-Spacing   ********/
table {
    border-spacing: 10px;
    border-collapse: separate;
}

td {
  border: 1px solid red;
}
Head1 Head2 Head3 Head4
11 12 13 14
21 22 23 24
31 32 33 34
41 42 43 44

/********* Cell-Spacing   ********/
table {
    border-spacing: 10px;
    border-collapse: separate;
}

td {
  border: 1px solid red;
}

More table style by CSS source link here you get more table style by CSS.

提交回复
热议问题