Replies: 4 comments 1 reply
-
You could try using |
Beta Was this translation helpful? Give feedback.
-
Thanks, I gave that a try, and it's a slight improvement: It expands the row height so that the labels fit, however, I can't persuade it (I tried all modes for this property) to rotate the other way (-90° instead of 90°), and none of the usual text alignment classes seem to do anything, so the labels are stuck at centre bottom (from the rotated perspective). Also this approach only works with the nested div; setting it on the |
Beta Was this translation helpful? Give feedback.
-
If you nest the text in a |
Beta Was this translation helpful? Give feedback.
-
Thanks, I have finally got it to work, but it's quite painful! <tr>
<th scope="col" class="text-left whitespace-nowrap h-32 pb-4 align-bottom">Item</th>
@foreach ($months as $month)
<th scope="col" class="whitespace-nowrap w-16 h-32 pb-4">
<div class="origin-right text-left -rotate-90 w-16 pb-4">{{ $month }}</div>
</th>
@endforeach
<th scope="col" class="whitespace-nowrap w-16 h-40 pb-4">
<div class="origin-right text-left -rotate-90 w-16 font-bold pb-4">Grand Total</div>
</th>
</tr> |
Beta Was this translation helpful? Give feedback.
-
If I add a rotation class like
-rotate-90
to table header classes, they rotate, but their spacing and bounding boxes do not go with them, so it just makes a mess. My markup is like this:and it renders like this:
The column widths are set by the length of the month label (even though the length is no longer the width!), similarly the height has remained as the original text height, so the labels spill over into the row below, and are cropped off at the top. The
th
tags also havetext-right
applied, but they have become centred vertically.I saw some suggestions to apply rotations to a nested div so the table cell would change itself to fit, but this made no difference:
How can I rotate these labels and get control of their bounding boxes and alignment?
Beta Was this translation helpful? Give feedback.
All reactions