I like the idea behind this article, but "Responsive Tables #2: Flexbox" really is a pretty good example of what _not_ to do. Just hiding the table header definitely does not work - this is how I first "read" the data: - Slice of Pizza = 450 - 95% = $5.00 - Common = 8/10 And this clearly doesn't make any sense at all. PS: I would love to see Markdown formatting make it to HN comments one day...
Making Tables Responsive with Minimal CSS
11–20 of 39 posts
Re: Making Tables Responsive with Minimal CSS
#12There are other approaches which avoid the repetition of column names in SPAN chunks as suggested in the article. The most elegant and least bandwidth consuming one is described in https://css-tricks.com/responsive-data-tables/ and uses modern CSS selectors: td:nth-of-type(1):before { content: "Type of Food"; } td:nth-of-type(2):before { content: "Calories"; } td:nth-of-type(3):before { content: "Tasty Factor"; } ...
Thanks for the additional option - I've updated the article to include that possibility as well
Re: Making Tables Responsive with Minimal CSS
#13Earlier quoted context omitted.
That's really not ideal. That is putting hardcoded data in CSS.
There's a ton of information in the CSS already - anything that uses color to denote meaning, or the layout of a component, or the order of items in a flex list, and so on. That's all data in a page's information hierarchy. Plus, the content attribute of the ::before and ::after pseudoelements literally exists for injecting content in to a page using CSS. Why not use it?
Re: Making Tables Responsive with Minimal CSS
#14Re: Making Tables Responsive with Minimal CSS
#15Re: Making Tables Responsive with Minimal CSS
#16I like the idea behind this article, but "Responsive Tables #2: Flexbox" really is a pretty good example of what _not_ to do. Just hiding the table header definitely does not work - this is how I first "read" the data: - Slice of Pizza = 450 - 95% = $5.00 - Common = 8/10 And this clearly doesn't make any sense at all. PS: I would love to see Markdown formatting make it to HN comments one day...
Remove the borders and background shading from that example and it will read just fine as a set of attributes
Re: Making Tables Responsive with Minimal CSS
#17There are other approaches which avoid the repetition of column names in SPAN chunks as suggested in the article. The most elegant and least bandwidth consuming one is described in https://css-tricks.com/responsive-data-tables/ and uses modern CSS selectors: td:nth-of-type(1):before { content: "Type of Food"; } td:nth-of-type(2):before { content: "Calories"; } td:nth-of-type(3):before { content: "Tasty Factor"; } ...
Re: Making Tables Responsive with Minimal CSS
#18Re: Making Tables Responsive with Minimal CSS
#19Re: Making Tables Responsive with Minimal CSS
#20Often we want a completely different layout for mobile, and to focus on different data. Shoehorning the same markup for both cases just makes it harder to work with.