diff options
author | Bradley Taunt <bt@btxx.org> | 2024-05-26 12:35:41 -0400 |
---|---|---|
committer | Bradley Taunt <bt@btxx.org> | 2024-05-26 12:35:41 -0400 |
commit | fa6aded86998639a53aecfa7b76e0ecd800fd9f0 (patch) | |
tree | 31d8e2fd1c9c9eb335151ab15301283156824a55 /_posts/Please_Make_Your_Table_Headings_Sticky.mdwn | |
parent | 010763789952b38c4974ae81d2fced03e623e2f8 (diff) |
More post cleanup, mobile styling fixes
Diffstat (limited to '_posts/Please_Make_Your_Table_Headings_Sticky.mdwn')
-rw-r--r-- | _posts/Please_Make_Your_Table_Headings_Sticky.mdwn | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/_posts/Please_Make_Your_Table_Headings_Sticky.mdwn b/_posts/Please_Make_Your_Table_Headings_Sticky.mdwn deleted file mode 100644 index 7ecda82..0000000 --- a/_posts/Please_Make_Your_Table_Headings_Sticky.mdwn +++ /dev/null @@ -1,28 +0,0 @@ -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="https://btxx.org/posts/Please_Make_Your_Table_Headings_Sticky/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="https://btxx.org/ikiwiki/git/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`: - - 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/) |