diff options
author | Bradley Taunt <bt@btxx.org> | 2024-07-02 14:28:49 -0400 |
---|---|---|
committer | Bradley Taunt <bt@btxx.org> | 2024-07-02 14:28:49 -0400 |
commit | dc6db80fa72286704849ef61ee0e5ccb5841cb09 (patch) | |
tree | 9235d796229d49211c27a07b9d18585d503baa94 /_posts/2024-02-23-Please_Make_Your_Table_Headings_Sticky.md | |
parent | 088c87bcb58be576308da503d4f11a68843c5013 (diff) |
Conversion to barf for testing purposes
Diffstat (limited to '_posts/2024-02-23-Please_Make_Your_Table_Headings_Sticky.md')
-rw-r--r-- | _posts/2024-02-23-Please_Make_Your_Table_Headings_Sticky.md | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/_posts/2024-02-23-Please_Make_Your_Table_Headings_Sticky.md b/_posts/2024-02-23-Please_Make_Your_Table_Headings_Sticky.md deleted file mode 100644 index 3a9e611..0000000 --- a/_posts/2024-02-23-Please_Make_Your_Table_Headings_Sticky.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -layout: post -title: Please Make Your Table Headings Sticky ---- - -I often stumble upon large data sets or table layouts across the web. When these tables contain hundreds of rows of content, things become problematic once you start to scroll... - - <video width="100%" controls> - <source src="/public/videos/not-fixed-header-tables.mp4" type="video/mp4"> -Your browser does not support the video tag. -</video> - -Look at that table header disappear! Now, if I scroll all the way down to item #300 (for example) will I remember what each column's data is associated with? If this is my first time looking at this table - probably not. Luckily we can fix this (no pun intended!) with a tiny amount of CSS. - -## Sticky Header - -Check it out: - - <video width="100%" controls> - <source src="/public/videos/fixed-header-tables.mp4" type="video/mp4"> -Your browser does not support the video tag. -</video> - -Pretty awesome, right? It might look like magic but it's actually very easy to implement. You only need to add 2 CSS properties on your `thead`: - -```scss -position: sticky; -top: 0; -``` - -That's it! Best of all, `sticky` has [~96% global support](https://caniuse.com/?search=sticky) which means this isn't some "bleeding-edge" property and can safely support a ton of browsers. Not to mention the improved experience for your end-users! - -You can view a live demo of this table on the [CodePen example pen](https://codepen.io/bradleytaunt/pen/bGZyJBj). - -If you found this interesting, feel free to check out my other table-focused post: [Making Tables Responsive With Minimal CSS](https://btxx.org/posts/tables/) |