A table that looks good on mobile and desktop
many.pw
many.pw
name: Zog, Luna, Glimmer, Xylon, Astra
age: 150, 200, 75, 300, 120
species: Xenon, Lunarian, Nebulite, Celestial, Stardust
home_planet: Zeta-7, Moon, Nebula-9, Alpha Centauri, Polaris
language: Zorgon, Lunar, Stellar, Cosmic, Celestial
occupation: Astrobiologist, Quantum Physicist, Astroengineer, Interstellar Diplomat, Astroarchaeologist
or just rotate the table:
name: Zog, Luna, Glimmer, Xylon, Astra
age: 150, 200, 75, 300, 120
species: Xenon, Lunarian, Nebulite, Celestial, Stardust
home_planet: Zeta-7, Moon, Nebula-9, Alpha Centauri, Polaris
language: Zorgon, Lunar, Stellar, Cosmic, Celestial
occupation: Astrobiologist, Quantum Physicist, Astroengineer, Interstellar Diplomat, Astroarchaeologist
Having to scroll is fineIf not, you could probably just paste it into Eruda (https://eruda.liriliri.io/)
I don't mind having to scroll a table if it doesn't fit in the view. Scrolling is better than trying to mentally piece together the rows and columns.
As in a lot of areas, less fussing with styles/CSS is better.
Yeah, it's marginally more strain on your eyeballs to track some 30 degrees across your field of view than glancing back and forth, but that only matters if you're reading every single value from left to right, row by row. It's extremely common to want to also compare values from top to bottom, column by column - or even just one particular column, known only to the reader. That's the whole point of a 2D table.
It's one thing for an e-reader to have an option to flow longform text across multiple columns for that one guy with a 5120 x 2160 monitor who chooses to view the text in full-screen, another to apply "too wide is bad" everywhere.
In particular, this looks stupidly blank in landscape mode on my 21:9 smartphone. Toggling Firefox to "Desktop Mode" shows it easily fits in that orientation.
I actually think this is probably the more practical approach, though I wonder what screen readers make of the mobile version compared to traversing a normal table structure.
https://github.com/andrewarrow/a-table-that-looks-good-on-mo...
{{ $wrap := "whitespace-nowrap" }}
and I set:
colAttributes := map[int]string{}
colAttributes[0] = "w-1/2"
https://github.com/andrewarrow/a-table-that-looks-good-on-mo...to make tailwind handle a column that needs to wrap.
Also, tables are good for scanning for something in a lot of data. Cards don't do that very well.