I would like to do something like this but I'm not able to do it.
I know how to rotate the text with :
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
-ms-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
transform: rotate(-90deg);
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
But I don't know how to keep it aligned in the center of the cell.
Could you help me?
Right-click and then select "Format Cells" from the popup menu. When the Format Cells window appears, select the Alignment tab. Then set the number of degrees that you wish to rotate the text. This value ranges from 90 degrees to -90 degrees for Orientation.
(I simplified the table a bit to allow me to focus on the part that does the vertical text.) The first trick is to use writing-mode: vertical-lr to get the text to run vertically. By itself, the text runs top to bottom, but we want it to run bottom to top, so we spin it around it with the transform: rotate(180deg) .
If what you are looking for is a way to set type vertically, you're best bet is probably CSS writing-mode . The rotation property of Internet Explorer's BasicImage filter can accept one of four values: 0, 1, 2, or 3 which will rotate the element 0, 90, 180 or 270 degrees respectively.
Taken from: https://stackoverflow.com/a/27258573/6376949
.rotate {
display: inline-block;
filter: progid: DXImageTransform.Microsoft.BasicImage(rotation=3);
-webkit-transform: rotate(270deg);
-ms-transform: rotate(270deg);
transform: rotate(270deg);
}
.tblborder,
.tblborder td,
.tblborder th {
border-collapse: collapse;
border: 1px solid #000;
}
.tblborder td,
.tblborder th {
padding: 20px 10px;
}
<table class="tblborder">
<tr>
<th>
<div class="rotate">header</div>
</th>
<th>
<div class="rotate">header</div>
</th>
<th>
<div class="rotate">header</div>
</th>
</tr>
<tr>
<td>
<div class="rotate">detail</div>
</td>
<td>detail</td>
<td>detail</td>
</tr>
<tr>
<td>detail</td>
<td>detail</td>
<td>detail</td>
</tr>
</table>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With