WeasyPrint
WeasyPrint copied to clipboard
Long TOC entries wraps around
For my TOC I used the book example, which works great.
However, when the header is too long, it wraps down across to form an extra line.
How can I prevent this from happening, either by truncating it somehow (with an ellipsis) or whatever?
Hi!
You can use the text-overflow property for that:
<style>
div {
border: 1px solid;
overflow: hidden;
text-overflow: ellipsis;
white-space: pre;
width: 8em;
}
</style>
<div>lorem ipsum dolor sit amet</div>
@kgish sidenote, you'll rarely if ever find something like this in a published work, so possibly reworking header titles might be the better option.