sticky positioning<\/a> to the first column there.)<\/p>\n\n\nAccessibility<\/h2>\n\n\n
Let’s not totally forget about accessibility here. I ran the table through NVDA on Windows and VoiceOver on macOS and found that all five columns are announced, even if we’re only using four of them. And when the first column is in focus, it announces, “Column one through two”. Not perfectly elegant but also not going to cause someone to get lost. I imagine we could throw an aria-hidden<\/code> attribute on the unused column, but also know ARIA isn’t a substitute for poor HTML.<\/p>\n\n\n\n
\n\n\n\nI\u2019ll admit, this feels a little, um, hacky. But it does work! Let me know if you have a different approach in the comments\u2026 or know of any confusions this \u201chack\u201d might bring to our users.<\/p>\n","protected":false},"excerpt":{"rendered":"
The good ol\u2019 <table> tag is the most semantic HTML for showing tabular data. But I find it very hard to control how the table is presented, particularly column widths in a dynamic environment where you might not know how much content is going into each table cell. In some cases, one column is super […]<\/p>\n","protected":false},"author":288726,"featured_media":292600,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"sig_custom_text":"","sig_image_type":"featured-image","sig_custom_image":0,"sig_is_disabled":false,"inline_featured_image":false,"c2c_always_allow_admin_comments":false,"footnotes":"","jetpack_publicize_message":"Clever little trick from Anders Pederson to fake min-width on a table column.","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":[]},"categories":[4],"tags":[1496,1004,651],"jetpack_publicize_connections":[],"acf":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2019\/07\/table-pattern.png?fit=1200%2C600&ssl=1","jetpack-related-posts":[{"id":173860,"url":"https:\/\/css-tricks.com\/fixing-tables-long-strings\/","url_meta":{"origin":376307,"position":0},"title":"Fixed Table Layouts","date":"July 2, 2014","format":false,"excerpt":"There is a CSS property for tables that, it seems to me, is well-supported, little known, and super useful. It changes the way that tables are rendered such that it gives you a sturdier, more predictable layout. It is this: table { table-layout: fixed; } The default property for table-layout\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":239489,"url":"https:\/\/css-tricks.com\/accessible-simple-responsive-tables\/","url_meta":{"origin":376307,"position":1},"title":"Accessible, Simple, Responsive Tables","date":"March 22, 2016","format":false,"excerpt":"There is no single solution to make any appropriately responsive. That's what I like about this post by Davide Rizzo: it admits that, then gets on with some solutions. This is a great addition to territory we've been treading for a while. Content and Comparison tables There are many types\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":150162,"url":"https:\/\/css-tricks.com\/complete-guide-table-element\/","url_meta":{"origin":376307,"position":2},"title":"A Complete Guide to the Table Element","date":"September 19, 2013","format":false,"excerpt":"The
element in HTML is used for displaying tabular data. You can think of it as a way to describe and display data that would make sense in spreadsheet software. Essentially: columns and rows. In this article, we\u2019re going to look at how to use them, when to use\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2013\/09\/table-guide.png?fit=1200%2C600&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":15891,"url":"https:\/\/css-tricks.com\/responsive-data-table-roundup\/","url_meta":{"origin":376307,"position":3},"title":"Responsive Data Table Roundup","date":"January 11, 2012","format":false,"excerpt":"There has been a bunch of takes on responsive data tables since I first published about it. View Demo The idea of the original was to abandon the grid layout of the table and make each cell its own line. Each of those lines is labeled with a pseudo element.\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2012\/01\/zurb-responsive-tables.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":7692,"url":"https:\/\/css-tricks.com\/fluid-width-equal-height-columns\/","url_meta":{"origin":376307,"position":4},"title":"Fluid Width Equal Height\u00a0Columns","date":"October 18, 2010","format":false,"excerpt":"Equal height columns have been a need of web designers forever. If all the columns share the same background, equal height is irrelevant because you can set that background on a parent element. But if one or more columns need to have their own background, it becomes very important to\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2010\/10\/desire1.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":298375,"url":"https:\/\/css-tricks.com\/some-css-grid-strategies-for-matching-design-mockups\/","url_meta":{"origin":376307,"position":5},"title":"Some CSS Grid Strategies for Matching Design Mockups","date":"November 14, 2019","format":false,"excerpt":"The world of web development has always had a gap between the design-to-development handoff. Ambitious designers want the final result of their effort to look unique and beautiful (and true to their initial vision), whereas many developers find more value in an outcome that is consistent, dependable, and rock solid\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2019\/11\/grid-lines.png?fit=1200%2C600&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/posts\/376307"}],"collection":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/users\/288726"}],"replies":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/comments?post=376307"}],"version-history":[{"count":5,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/posts\/376307\/revisions"}],"predecessor-version":[{"id":376318,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/posts\/376307\/revisions\/376318"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/media\/292600"}],"wp:attachment":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/media?parent=376307"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/categories?post=376307"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/tags?post=376307"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}