开发者

Can you have cellspacing between the rows in a html table without having it for columns

开发者 https://www.devze.com 2023-01-14 04:21 出处:网络
I am开发者_高级运维 looking for a solution for having cellspacing between each of the rows of a table but not between the columns.Is this possible?You can separate rows in a table using the border-spa

I am开发者_高级运维 looking for a solution for having cellspacing between each of the rows of a table but not between the columns. Is this possible?


You can separate rows in a table using the border-spacing property:

table {
    border-collapse:separate;
    border-spacing: 0 10px;
}

This sets the space between columns to zero and the space between rows to 10px. If you supply one argument, then that length will be applied to both the vertical spacing and the horizontal spacing; with two arguments, the first will set the horizontal spacing and the second will set the vertical spacing.


The border-spacing is nice, but IE6/7 doesn't understand that. If you want to cover them as well, then rather do:

table { 
    border-collapse: collapse;
}
td {
    border: 10px solid white; /* Or any color which matches table's bgcolor */
    border-width: 10px 0;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消