Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to make a table, which is wider than screen size, scrollable and keep header row fixed?
    primarykey
    data
    text
    <p>I've a <a href="http://jsbin.com/uwubu3/3" rel="nofollow noreferrer">table</a> with 2 columns and each column is 800px wide. I want to show this table in 800x50 window. So there should be horizontal and vertical scrollbar to view complete table.</p> <p>While I've found few related solutions (<a href="https://stackoverflow.com/questions/983031/jquery-how-to-freeze-table-header-and-allow-scrolling-of-the-rest-of-the-rows">this</a> and <a href="https://stackoverflow.com/questions/486576/frozen-table-header-inside-scrollable-div/1533619#1533619">this</a>) on SO, they only work if table width is smaller than screen size. In my case screen size is 1200px and total table width is 1600px.</p> <p>How could I do this? i want to achieve something like <a href="http://jsbin.com/olibo" rel="nofollow noreferrer">this</a>.</p> <p><strong>EDIT</strong> Oops, I forgot to add one more requirement. Sorry. I want the header of the table to remain fixed while user scrolls table.</p> <p><strong>EDIT2</strong></p> <p>I've tried below mentioned solutions to wrap in a div, but in this case vertical scrollbar doesn't show up. Please see <a href="http://jsbin.com/uwubu3/3" rel="nofollow noreferrer">this table</a> with wrapper div. It seems this problem only occurs if table width is bigger than screen size. I'm testing on FF3.6. </p> <p><strong>EDIT3</strong></p> <p>current <a href="http://jsbin.com/uwubu3/3" rel="nofollow noreferrer">table</a> code. This has no vertical scroller even though I can scroll vertically.</p> <pre><code>&lt;div style="overflow:scroll; width:800px;height:50px" &gt; &lt;table style="width:1600px" border="1"&gt; &lt;thead&gt; &lt;tr&gt; &lt;th style="width:800px"&gt;id_1&lt;/th&gt; &lt;th style="width:800px"&gt;id_1&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody style=""&gt; &lt;tr&gt;&lt;td&gt;1200&lt;/td&gt;&lt;td&gt;1200&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;1200&lt;/td&gt;&lt;td&gt;1200&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;1200&lt;/td&gt;&lt;td&gt;1200&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;1200&lt;/td&gt;&lt;td&gt;1200&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;1200&lt;/td&gt;&lt;td&gt;1200&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;1200&lt;/td&gt;&lt;td&gt;1200&lt;/td&gt;&lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/div&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    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