Making Tables Responsive with Minimal CSS
bradleytaunt.com
Making Tables Responsive with Minimal CSS
1–10 of 39 posts
Re: Making Tables Responsive with Minimal CSS
#2The 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
#3There 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
#4There 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
#5There 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"; } ...
That's really not ideal. That is putting hardcoded data in CSS.
Re: Making Tables Responsive with Minimal CSS
#6Just 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...
Re: Making Tables Responsive with Minimal CSS
#7Earlier quoted context omitted.
That's really not ideal. That is putting hardcoded data in CSS.
You could move the data into a data attribute, and then use "content: attr(data-td)" for example.
https://codepen.io/andrelaszlo/pen/xoxmdg
Is there a way to only define the header label once and refer to them depending on the cell using only CSS?
Re: Making Tables Responsive with Minimal CSS
#8There 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"; } ...
That's really not ideal. That is putting hardcoded data in CSS.
Re: Making Tables Responsive with Minimal CSS
#9There 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"; } ...
That's really not ideal. That is putting hardcoded data in CSS.
Re: Making Tables Responsive with Minimal CSS
#10I 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...