下面是输出表:
我正在寻找一种可以减小表头宽度的解决方案,我尝试了几种解决方案,但都没有奏效。下面是我的代码:
<Style>
/*additional CSS*/
td,
th {
border: 1px solid black;
font-family: Calibri (Body) !important;
}
table {
border-collapse: collapse;
}
* {
font-family: 'Calibri (Body) !important';
line-height: 0.5 em;
}
.header {
text-align: center;
white-space: nowrap;
transform-origin: 50% 50%;
transform: rotate(-90deg);
}
.header:before {
content: '';
padding-top: 110%;
/* takes width as reference, + 10% for faking some extra padding */
display: inline-block;
vertical-align: middle;
}
.header:after {
background-color: #005CB9;
color: white;
}
</Style>
<table border="1">
<thead>
<tr style=" background-color: #005CB9;color: white;">
<td style='text-align: center;'>
<strong>Activity</strong>
</td>
<td class='header'>
<strong>Screening</strong>
</td>
<td class='header'>
<strong>ABCDEFGHJIJKLMNOPQRSTUVWXYZ12345-1</strong>
</td>
<td class='header'>
<strong>ABCDEFGHJIJKLMNOPQRSTUVWXYZ12345 1</strong>
</td>
<td class='header'>
<strong>ABCDEFGHJIJKLMNOPQRSTUVWXYZ12345 2</strong>
</td>
<td class='header'>
<strong>ABCDEFGHJIJKLMNOPQRSTUVWXYZ12345 3</strong>
</td>
<td class='header'>
<strong>ABCDEFGHJIJKLMNOPQRSTUVWXYZ12345 4</strong>
</td>
<td class='header'>
<strong>ABCDEFGHJIJKLMNOPQRSTUVWXYZ12345 5</strong>
</td>
<td class='header'>
<strong>ABCDEFGHJIJKLMNOPQRSTUVWXYZ12345 6</strong>
</p class='headerText'>
</td>
<td class='header'>
<strong>ABCDEFGHJIJKLMNOPQRSTUVWXYZ12345 7</strong>
</td>
<td class='header'>
<strong>ABCDEFGHJIJKLMNOPQRSTUVWXYZ12345 8</strong>
</td>
<td class='header'>
<strong>ABCDEFGHJIJKLMNOPQRSTUVWXYZ12345 9</strong>
</td>
<td class='header'>
<strong>ABCDEFGHJIJKLMNOPQRSTUVWXYZ12345 10</strong>
</td>
<td class='header'>
<strong>ABCDEFGHJIJKLMNOPQRSTUVWXYZ12345 11</strong>
</td>
<td class='header'>
<strong>ABCDEFGHJIJKLMNOPQRSTUVWXYZ12345 12</strong>
</td>
<td class='header'>
<strong>ABCDEFGHJIJKLMNOPQRSTUVWXYZ12345 13</strong>
</td>
<td class='header'>
<strong>ABCDEFGHJIJKLMNOPQRSTUVWXYZ12345 14</strong>
</td>
<td class='header'>
<strong>ABCDEFGHJIJKLMNOPQRSTUVWXYZ12345 15</strong>
</td>
<td class='header'>
<strong>ABCDEFGHJIJKLMNOPQRSTUVWXYZ12345 16</strong>
</td>
<td class='header'>
<strong>ABCDEFGHJIJKLMNOPQRSTUVWXYZ12345 17</strong>
</td>
<td class='header'>
<strong>ABCDEFGHJIJKLMNOPQRSTUVWXYZ12345 23 (Follow-Up Visit)
</strong>
</td>
<td class='header'>
<strong>ABCDEFGHJIJKLMNOPQRSTUVWXYZ12345 Premature Discontinuation</strong>
</td>
</tr>
</thead>
</table>