In my Bootstrap 4 project, I'm having difficulties with positioning rotated text within a table header. My goal is to align all the rotated text at the bottom of the cell and centered horizontally. Despite trying different transform-origins, it seems that center is the most appropriate one?
Can anyone explain why the cell text for the rotated headers ends up outside the boundaries of the cell borders?
.table-rotated-header {
transform-origin: center;
transform: rotate(-90deg);
height: 250px;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<table id="datatable-buttons" class="table table-striped table-bordered dt-responsive nowrap" style="border-collapse: collapse; border-spacing: 0; width: 100%;">
<thead>
<tr>
<th> </th>
<th colspan="5" class="text-center">
<h3>Paint</h3</th>
<th colspan="2" class="text-center">
<h3>Wheels</h3>
</th>
<th colspan="2" class="text-center">
<h3>Interior</h3>
</th>
</tr>
<tr>
<th nowrap class="table-rotated-header">
<h5>Country</h5>
</th>
<th nowrap class="table-rotated-header">
<h5>White</h5>
</th>
<th nowrap class="table-rotated-header">
<h5>Red</h5>
</th>
<th nowrap class="table-rotated-header">
<h5>Blue</h5>
</th>
<th nowrap class="table-rotated-header">
<h5>Black</h5>
</th>
<th nowrap class="table-rotated-header">
<h5>Yellow</h5>
</th>
<th nowrap class="table-rotated-header">
<h5>18" Spider</h5>
</th>
<th nowrap class="table-rotated-header">
<h5>19" Sport</h5>
</th>
<th nowrap class="table-rotated-header">
<h5>Black</h5>
</th>
<th nowrap class="table-rotated-header">
<h5>White</h5>
</th>
</tr>
</thead>
<tbody>
<tr>
<td>South Korea</td>
<td class="text-end">$10,400</td>
<td class="text-end">$900</td>
<td class="text-end">$0</td>
<td class="text-end">$0</td>
<td class="text-end">Included</td>
<td class="text-end">$900</td>
<td class="text-end">$12,200</td>
<td class="text-end">$6000</td>
<td class="text-end">$6000</td>
</tr>
</tbody>
</table>