Alternatively, style the tbody with a predetermined size (via height:20em, for example) and use overflow-y:scroll; Then, you can have a huge tbody, which will scroll independently of the rest of the page. But it is now. This plugin is really slow with large tables. Create HTML¶ Add a
tag. That's brilliant in its simplicity. It has the first column fixed. I don't know how ie handles it though. This doesn't handle arbitrary labels. I need a simple solution. .horizontal-scroll-except-first-column { width: 100%; overflow: auto; margin-left: 20em; } .horizontal-scroll-except-first-column > table > * > tr > th:first-child, .horizontal-scroll-except-first-column > table > * > tr > td:first-child { position: absolute; width: 20em; margin-left: -20em; } .horizontal-scroll-except-first-column > table > * > tr > th, .horizontal-scroll-except-first-column > table > * > tr > td ⦠It will make the column/row stick to its current position. "leftï¼0" @Thomas1703 You should use the Migrate Plugin from jQuery if a plugin does not work with 1.9.x ->. HTML table with horizontal scrolling (first column fixed),
Col 5
Header A
col 1 - A
for my own reasons, i used a class to indicate which column were to be fixed, and, for good measure, added a. Hi , In above code how to increase the width of first(fixed/frozen) column of the table. Horizontal scroll with fixed column is added to exiting smart-table code and also infinite scroll added to table Thanks for contributing an answer to Stack Overflow! In Scrollbar in HTML Table is one of the features to scroll the data from both horizontal and vertical formats. Still doesn't work. Thatâs why the SC starts with âContentâ rather than âPagesâ, so that even if you have some content with horizontal scrolling⦠Checkout my example codepen here https://codepen.io/swastikmishra/pen/zYYdKBQ. Connect and share knowledge within a single location that is structured and easy to search. Yeah; you should skip the whole "table" part and just use two divs, one for the left column and one for the rest of the content. Join Stack Overflow to learn, share knowledge, and build your career. I reset my laptop and now Steam games are all missing, Dealing with unpleasant people in conferences, Subtour elimination constraint in Travelling Salesman Problem. Are there any retrocomputing museums in the former Eastern Bloc countries? .table-scroll { position:relative; max-width:600px; margin:auto; overflow:hidden; border:1px solid #000; } .table-wrap { width:100%; overflow:auto; } .table-scroll table { width:100%; margin:auto; border-collapse:separate; border-spacing:0; } .table-scroll th, .table-scroll td { padding:5px 10px; border:1px solid #000; background:#fff; white-space:nowrap; vertical-align:top; } .table-scroll thead, .table-scroll ⦠Assuming you're using modern browsers nowadays, I came up with a solution using CSS calc() to help guarantee widths met up. In HTML5, you can use CSS style.transform. Pythagorean triplets generated in a unique way. The table contains header, body and footer parts The header and footer will be sticky on the top and bottom respectively The first column of the body will be sticky on the left side when you scroll the horizontal bar The key is to use "position: sticky;" in CSS style sheet and give the target element a position value, e.g. Unless you have very predictably short labels, you will get this: @AaronLS: yep, you need to specify the width of the first column. Does a SQL Server Update statement for nvarchar overwrite the same address on disk if the new value is the same size? Battlefield Tactics for eleven pixies carrying a machine gun. This is an interesting jQuery plugin that creates fixed headers and/or columns. Essentially the solution moves the headers off from the table and set each of them a 5em width. https://codepen.io/paulobrien/pen/gWoVzN. It works in all the browsers I have locally installed. Because the columns are 100px wide, each following column is positioned another 100px left So, the first one is 0px, then 100px for col2, etc) to avoid overlap with the previous column. Making statements based on opinion; back them up with references or personal experience. Manga where the protagonist saves his two friends, but in doing so, winds up trapped in a cave fighting monsters for ten years, Simulate bitmap mode in photoshop for e-ink photo preparation. Thank You! Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, PHP, Python, Bootstrap, Java and XML. This should be the accepted answer. The original table is in a div that allows the table to scroll horizontally while the cloned div is placed out of that context and does not scroll. Making statements based on opinion; back them up with references or personal experience. How and why can multiple people control the Boeing B-29? License. I just made the right-most sticky column of a table sticky. Another option was to do something like this. How do I style a