Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle tables used for layout #18

Open
waldyrious opened this issue Sep 12, 2016 · 2 comments
Open

Handle tables used for layout #18

waldyrious opened this issue Sep 12, 2016 · 2 comments

Comments

@waldyrious
Copy link
Owner

waldyrious commented Sep 12, 2016

Such tables should not be styled the same way as actual data tables. Fortunately, this is becoming rarer, but it's still found in the wild every now and then.

Note: Before working on this, I want to collect a list of pages here that demonstrate the issues with tables, so that implementations addressing this can be tested against them.

(I'll keep editing this comment to add more, and crossing out those that have since changed their source code.)

waldyrious added a commit that referenced this issue Sep 12, 2016
@waldyrious waldyrious changed the title Don't style tables used for layout the same as actual data tables Don't style tables used for layout the same way as actual data tables Dec 11, 2016
waldyrious added a commit that referenced this issue Apr 23, 2017
waldyrious added a commit that referenced this issue Sep 19, 2017
In d4990b5 the serif definition was introduced for layout tables,
and at the time was identical to the font-family of the body,
but when the font-family for the body was changed in de977b2,
the table definition wasn't updated accordingly.

This is precisely the use case for CSS variables.
waldyrious added a commit that referenced this issue Sep 19, 2017
use CSS variable for font-family (#27, #18)
@waldyrious waldyrious changed the title Don't style tables used for layout the same way as actual data tables Handle tables used for layout Nov 10, 2017
@waldyrious
Copy link
Owner Author

As a quick hack, removing the body { max-width: 40em } rule improves the situation a bit, but the main content can become too wide to read comfortably.

Perhaps something more drastic as hiding (with display:none) any table elements with id or class containing "sidebar" (or similar terms) could help, e.g.:

td[id*="sidebar"] { display:none; }

But this would get lots of false positives and false negatives...

@waldyrious
Copy link
Owner Author

waldyrious commented Sep 14, 2018

Looks like there might be a nice way to flatten tables revert to HTML's original 1D flow (vertically stacked blocks). From this StackOverflow answer:

tr { display:flex; flex-wrap:wrap; }
td { width:100%; }

Or even simpler, from this other answer to the same question:

table, td { display:block; width:100%; }

That second example is basically the "collapse to blocks" approach presented as #3 in this CSS-tricks article.

Anyway, sounds promising. I just need to test it (and figure out a good heuristic for detecting tables used for page layout).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant