I have a table with headings that are rotated and then the height is dynamically resized so it doesn't overlap the content above. Please see this Fiddle to understand what I mean.
I want to make column 2 width the size of a checkbox ie same as column 1. But I do not want to fix the table width.
.verticalTableHeader {
text-align: center;
white-space: nowrap;
g-origin: 50% 50%;
-webkit-transform: rotate(90deg);
-moz-transform: rotate(90deg);
-ms-transform: rotate(90deg);
-o-transform: rotate(90deg);
transform: rotate(90deg);
}
.verticalTableHeader p {
margin: 0 -100%;
display: inline-block;
}
.verticalTableHeader p:before {
content: '';
width: 0;
padding-top: 110%;
/* takes width as reference, + 10% for faking some extra padding */
display: inline-block;
vertical-align: middle;
}
//table {
text-align:center;
table-layout:fixed;
width:150px
}
<table border="1">
<tr>
<th class="verticalTableHeader">
<p>First</p>
</th>
<th class="verticalTableHeader">
<p>Secondlongheadear</p>
</th>
<th>
<p>Third</p>
</th>
</tr>
<tr>
<td>
<input class='checkbox' type='checkbox'>
</td>
<td>
<input class='checkbox' type='checkbox'>
</td>
<td>this is fine</td>
</tr>
<tr>
<td>
<input class='checkbox' type='checkbox'>
</td>
<td>
<input class='checkbox' type='checkbox'>
</td>
<td>responsive</td>
</tr>
<tr>
<td>
<input class='checkbox' type='checkbox'>
</td>
<td>
<input class='checkbox' type='checkbox'>
</td>
<td>not fixed width</td>
</tr>
</table>