I have a table that uses rowspan to combine 2 rows. I want the spacing between the 2 non combined rows to be closer whilst maintaining a larger spacing between the overall rows. For example, I would like row1 col1
and row2 col1
to be spaced closer together whilst having a larger space between row2 col1
and row3 col1
. This would apply to each overall row.
table { border-collapse: collapse; } td { border-bottom: 1px solid black; } .noborder { border:none; }
<table> <tr> <td class="noborder">row1 col1</td> <td rowspan=2>merge col2</td> </tr> <tr> <td>row2 col1</td> </tr> <tr> <td class="noborder">row3 col1</td> <td rowspan=2>merge col2</td> </tr> <tr> <td>row4 col1</td> </tr> <tr> <td class="noborder">row6 col1</td> <td rowspan=2>merge col2</td> </tr> <tr> <td>row6 col1</td> </tr> </table>
What this? But your td is not valid when you use one column and the next row two. Use the colspan ( https://www.w3schools.com/TAGs/att_td_colspan.asp ) attribute instead.
table {
border-collapse:separate;
border-spacing:5px;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.