Note that there are some explanatory texts on larger screens.

plurals
  1. POIs there a css3 way to fix a <thead> on the y-axis, let it scroll on the x-axis?
    primarykey
    data
    text
    <p>This has been asked a zillion times: <a href="https://stackoverflow.com/questions/2382083/fix-thead-on-page-scroll"><b>here</b></a>, <a href="https://stackoverflow.com/questions/4334205/how-can-i-tell-iscroll-that-a-tbody-should-scroll-and-vanish-behind-a-thead"> <b>there</b>,</a> and <a href="https://stackoverflow.com/questions/3938679/jquery-maybe-horizontally-fix-element-but-vertically-scroll-it"> <b>the other place</b></a> just on SO. Yet there's no real good answer that I can find.</p> <p>&lt;recap> Often I have tables that are vertically much deeper than the viewport. I'd like to be able to scroll the table's <code>&lt;tbody&gt;</code> while its <code>&lt;thead&gt;</code> remains fixed and visible. Some of these tables are also much wider than the viewport. Here I want the table's <code>&lt;thead&gt;</code> to scroll horizontally.</p> <p>To get the effect, I have dozens of lines of JS, including <code>setInterval( )</code> calls to check <code>scrollLeft</code> and <code>scrollTop</code>, so that I can reposition a <em>copy</em> of <code>&lt;thead&gt;</code><sup>1</sup>. It works but it's a huge, ungainly, frail and unmaintainable pain in the ass.&lt;/recap></p> <p><strong>Question:</strong> Is there some straightforward css3 way, existent or emerging or proposed, that I can use to get a a table's <code>&lt;thead&gt;</code> and <code>&lt;tbody&gt;</code> to scroll horizontally and vertically, yet independently of each other? Thanks! </p> <hr> <p><sup>1</sup> Why <code>setInterval( )</code>? Because IE doesn't uniformly deliver <code>onScroll</code> events, you silly; <em>everybody</em> knows that! </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload