I'm trying to create a table with headings that are vertical and without explicit sizing for height, is this currently possible with just HTML and CSS?
I'm avoiding using any JS as this HTML is being templated using Thymleaf & Spring. I'm avoiding explicit sizing for height as this will style multiple tables with different headings, so they will have different heights - otherwise there'll be wasted space above them or they'll be partially cut off.
Link to my codepen with a simple example of what I'm trying to achieve. I'd like the second heading to not overlap the rows below and for the whole heading to expand in height to accomdate it.
Code that can be found at the codepen link above:
<table>
<thead>
<tr>
<th>First Heading</th>
<th class="vertical">Second Heading</th>
</tr>
</thead>
<tbody>
<tr>
<td>Typical cell</td>
<td>Typical cell</td>
</tr>
<tr>
<td>Typical Cell cell</td>
<td>Typical Cell</td>
</tr>
</tbody>
</table>
.vertical {
transform: rotate(-90deg);
}
Edit: this has been marked as duplicate, but the question linked doesn't mention the height being an issue, and the answer includes a CSS property which is actually now deprecated. So I think this question is different enough that it shouldn't be considered a duplicate.