Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Codidact Meta!

Codidact Meta is the "town hall" (meta-discussion site) for the Codidact community network and the Codidact software. Whether you have bug reports or feature requests, support questions or rule discussions that touch the whole network – this is the site for you.

Comments on Avoiding wasting space in the Table of Contents

Post

Avoiding wasting space in the Table of Contents

+0
−0

The Table of Contents under a question displays the initial text of each answer. This is cut off at around 120 characters. On a standard monitor at standard 100% zoom, this takes up around a line and a half, leaving the second half of the second line empty, where more text could have been displayed:

Table of Contents showing around half a line wasted for each answer

When zoomed in, or on a narrower screen/window, the text can wrap onto more lines and sometimes end up taking up a new blank line solely for the ellipsis (as in the second and third answers in the image below):

Table of Contents zoomed in with 2 of the answers having a blank line just for the ellipsis

Would it be better to use the rest of the space, displaying however much text will fit on one line? For example, on a standard desktop screen 2 full lines of text could be displayed, while on a narrow mobile screen 3 full lines of text could be displayed.

What would you like to see?

History

1 comment thread

Ellipses (2 comments)
Ellipses
Michael‭ wrote 4 months ago

I'm not sure if this is already what you had in mind, but there is a text-overflow value of ellipsis to let the layout engine decide where to truncate based on the text and its container.

trichoplax‭ wrote 4 months ago

I didn't have a particular solution in mind, but that link seemed promising up until:

The text-overflow property only affects content that is overflowing a block container element in its inline progression direction (not text overflowing at the bottom of a box, for example).

Sounds like it would be perfect if the Table of Contents only included 1 line, but wouldn't work with wrapping for multiple lines. I haven't tested this though.

Maybe 1 line could be enough on desktop at 100% zoom, but on mobile or higher zoom on desktop would probably need at least 2 lines (for the amount of context I personally would prefer).

If the community votes to have only 1 line across devices and screen widths, then it seems like this CSS property would do all the work automatically.