Responsive Tables & Readable Paragraphs
Responsive Tables & Readable Paragraphs êŽë š
I have this habit where when Iâm watching a TV show where I like to read about it on my phone while Iâm watching it. Reviews, summaries, fan theories, whatever. Seems like that would be distracting â but I think itâs extra engaging sometimes. Iâd often end up on Wikipedia where they do episode informational summaries in a particular layout where the small screen layout had a horribly obnoxious side effect.
Here (was) the issue:

To their credit, they made the data table responsive in that itâs not zoomed out or cut off, you can horizontally scroll it. But horizontal scrolling is super terrible when youâre trying to read a paragraph of text.
Also to their credit, theyâve also (recently?) made this a bit better.
They put a wrapper element over the show description and added max-width: 90vw;
to the styles. It was kinda funny though, as I happen to notice that and I was looking at a page where that was still a smidge too wide and it was cutting off like 50px of text so there was still a bit of horizontal scrolling needed.
The problem is that 90vw
is a âmagic numberâ. Itâs essentially saying âpretty close to the width of the screen, but like, not all of it, because there is some padding and stuff the account for.â Itâs just a guess. I get it, sometimes you gotta just be close and move on, but here Iâve literally seen it fail, which is the whole downside of magic numbers.

If they were trying to be perfect about it, that max-width
would be set to account for all the other spacing. Something like:
.shortSummaryText {
/*
Viewport width minus 1rem of body padding on each side
and 0.5rem of padding inside the table cell,
minus the borders.
*/
max-width: calc(100dvw - 3rem - 2px);
}
Maybe those things are custom properties that could be grabbed, which would be even nicer. This kind of thing can be hard to maintain so I get it.
Notice in the screenshot above they also added position: sticky;
and stuck it to the left
side, which is a super classy touch! That way when the table is scrolled to see the other bits of information in a row, the readable paragraphs stay readable, rather than scroll over into just blank white nothingness.
I did a fork of the classic Under-Engineered Responsive Tables to include this feature.