I need to achieve a design where the book-spine
text is both visually centered and truncated inside the shelf
. It should resemble the spine of a book. However, when the text in book-spine
is too long, it should be cut off with an ellipsis.
- In the case of
book-spineFlex
withdisplay:flex;
, the text is centered but not truncated. - With
book-spineBlock
anddisplay:block;
, the text is truncated but lacks centering.
How can I achieve both centered alignment and truncation for the book-spine
within the shelf
?
CSS code example...
HTML structure code example...
I have already attempted using flexbox
without success (centered but no truncation). Trying to utilize position: relative
and position: absolute
led to truncation, but sacrificed the centering effect.