我正在使用表格创建这样的图表:
这就是我所拥有的: fiddle :https://jsfiddle.net/Wosley_Alarico/e8xmp6oh/
.rotate {
/* Safari */
-webkit-transform: rotate(-90deg);
/* Firefox */
-moz-transform: rotate(-90deg);
/* IE */
-ms-transform: rotate(-90deg);
/* Opera */
-o-transform: rotate(-90deg);
/* Internet Explorer */
filter: progid: DXImageTransform.Microsoft.BasicImage(rotation=3);
}
body.page.page-id-7.page-template-default.logged-in.admin-bar.wp-custom-logo.debug-bar-maximized.customize-support img {
width: 100px !important;
}
td {
/* letter-spacing: inherit; */
padding-top: 30%;
}
td.column {
background-color: #99c71b;
/* max-height: 586px !important; */
}
<table>
<tbody>
<tr>
<td class="column" rowspan="6">
<p class="rotate">Specialised Businesses</p>
</td>
</tr>
<tr>
<td>
<img class="alignnone size-medium wp-image-310" src="http://localhost/sidimaag/wp-content/uploads/2016/09/e-300x244.jpg" alt="e" width="300" height="244" />General Manager</td>
</tr>
<tr>
<td>
<img class="alignnone size-medium wp-image-310" src="http://localhost/sidimaag/wp-content/uploads/2016/09/e-300x244.jpg" alt="e" width="300" height="244" />
</td>
</tr>
<tr>
<td>
<img class="alignnone size-medium wp-image-310" src="http://localhost/sidimaag/wp-content/uploads/2016/09/e-300x244.jpg" alt="e" width="300" height="244" />
</td>
</tr>
<tr>
<td>
<img class="alignnone size-medium wp-image-310" src="http://localhost/sidimaag/wp-content/uploads/2016/09/e-300x244.jpg" alt="e" width="300" height="244" />
</td>
</tr>
<tr>
<td>
<img class="alignnone size-medium wp-image-310" src="http://localhost/sidimaag/wp-content/uploads/2016/09/e-300x244.jpg" alt="e" width="300" height="244" />
</td>
</tr>
</tbody>
</table>
看起来像这样:
如何使绿色单元格像第一张图片中那样变小并将文本放在一行中?
最佳答案
您应该能够通过将以下内容添加到您的旋转类来执行您想要的操作:
white-space:nowrap;
width:1.5em; /* whatever width you want */
overflow:visible;
更新的代码片段:
.rotate {
/* Safari */
-webkit-transform: rotate(-90deg);
/* Firefox */
-moz-transform: rotate(-90deg);
/* IE */
-ms-transform: rotate(-90deg);
/* Opera */
-o-transform: rotate(-90deg);
/* Internet Explorer */
filter: progid: DXImageTransform.Microsoft.BasicImage(rotation=3);
white-space: nowrap;
width: 1.5em;
overflow: visible;
}
body.page.page-id-7.page-template-default.logged-in.admin-bar.wp-custom-logo.debug-bar-maximized.customize-support img {
width: 100px !important;
}
td {
/* letter-spacing: inherit; */
padding-top: 30%;
}
td.column {
background-color: #99c71b;
/* max-height: 586px !important; */
}
<table>
<tbody>
<tr>
<td class="column" rowspan="6">
<p class="rotate">Specialised Businesses</p>
</td>
</tr>
<tr>
<td>
<img class="alignnone size-medium wp-image-310" src="http://localhost/sidimaag/wp-content/uploads/2016/09/e-300x244.jpg" alt="e" width="300" height="244" />General Manager</td>
</tr>
<tr>
<td>
<img class="alignnone size-medium wp-image-310" src="http://localhost/sidimaag/wp-content/uploads/2016/09/e-300x244.jpg" alt="e" width="300" height="244" />
</td>
</tr>
<tr>
<td>
<img class="alignnone size-medium wp-image-310" src="http://localhost/sidimaag/wp-content/uploads/2016/09/e-300x244.jpg" alt="e" width="300" height="244" />
</td>
</tr>
<tr>
<td>
<img class="alignnone size-medium wp-image-310" src="http://localhost/sidimaag/wp-content/uploads/2016/09/e-300x244.jpg" alt="e" width="300" height="244" />
</td>
</tr>
<tr>
<td>
<img class="alignnone size-medium wp-image-310" src="http://localhost/sidimaag/wp-content/uploads/2016/09/e-300x244.jpg" alt="e" width="300" height="244" />
</td>
</tr>
</tbody>
</table>
关于html - 如何在CSS中控制表格单元格的大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39746567/