aboutsummaryrefslogtreecommitdiff
path: root/posts/Please_Make_Your_Table_Headings_Sticky.md~
diff options
context:
space:
mode:
authorbt <bt@btxx.org>2024-06-08 13:22:19 -0400
committerbt <bt@btxx.org>2024-06-08 13:22:19 -0400
commitdcfb172704f3afb68a30425029ec834be2883274 (patch)
tree02ac480745db802d7af03f3213a0c568322170e3 /posts/Please_Make_Your_Table_Headings_Sticky.md~
parente146f8a64c793c337999ce316b16ebe5fe6f2dab (diff)
More content porting, on-going markdown changes for lowdown support
Diffstat (limited to 'posts/Please_Make_Your_Table_Headings_Sticky.md~')
-rw-r--r--posts/Please_Make_Your_Table_Headings_Sticky.md~29
1 files changed, 29 insertions, 0 deletions
diff --git a/posts/Please_Make_Your_Table_Headings_Sticky.md~ b/posts/Please_Make_Your_Table_Headings_Sticky.md~
new file mode 100644
index 0000000..1e7a602
--- /dev/null
+++ b/posts/Please_Make_Your_Table_Headings_Sticky.md~
@@ -0,0 +1,29 @@
+# Please Make Your Table Headings Sticky
+
+2024-02-23
+
+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...
+
+[Link to video example](/public/videos/not-fixed-header-tables.mp4)
+
+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`:
+
+ 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/)