position: sticky; a
<thead>. Nor a
<tr>. But you can sticky a
<th>, which means you can make sticky headers inside a regular ol’
<table>. This is tricky stuff, because if you didn’t know this weird quirk, it would be hard to blame you. It makes way more sense to sticky a parent element like the table header rather than each individiaul element in a row.
The issue boils down to the fact that stickiness requires
position: relative to work and that doesn’t apply to
<tr> in the CSS 2.1 spec.
There are two very extreme reactions to this, should you need to implement sticky table headers and not be aware of the
- Don’t use table markup at all. Instead, use different elements (
<div>s and whatnot) and other CSS layout methods to replicate the style of a table, but not locked out of using
position: relativeand creating
position: stickyparent elements.
- Use table elements, but totally…
This is only a snippet of article written by Chris Coyier
Read Full Article
This Content is Generated from RSS Feeds, if your content is featured and you would like to be removed, please Contact Us With your website address and name of site you wish to be removed from.
You can control what content is distributed in your RSS Feed by using your Website Editor.