How to align <td rowspan ="value"> value to center vertically?
use <td rowspan="4" align="center">4</td>
its work
table td {
padding: 5px;
}
<table border="1">
<tr>
<td>A</td>
<td>B</td>
<td>C</td>
<td>D</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td rowspan="4" align="center">4</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
</table>
You easily do it with css using CSS selectors and the vertical-align
property.
Any td
or th
by default has a rowspan = 1
.
To position the rowspan
'd td
text in the center, just do this:
Taking an example of rowspan = "3"
td[rowspan = "3"] {
vertical-align: middle;
}
If you want to make it generic, just use it as below:
th[rowspan]:not([rowspan="1"]) {
vertical-align : middle;
}
Try :
<td style="vertical-align : middle;text-align:center;">