
Frozen tables in HTML can be a real game-changer for data-heavy websites or applications, allowing users to scroll through tables while keeping the header row and leftmost columns in place.
This feature is particularly useful for large datasets that need to be sorted, filtered, or analyzed. It helps maintain a clear view of the data, even when scrolling through thousands of rows.
The HTML tr element is the backbone of a frozen table structure, defining the rows of data. Each tr element contains one or more td elements, which represent the individual cells within the table.
Frozen tables can be created using a combination of CSS and JavaScript, but HTML provides a simpler and more efficient way to achieve this functionality.
Consider reading: Advanced Html Tables Examples
Freezing HTML Table Rows and Columns
To freeze a row or column in an HTML table, you can use CSS with the `position: sticky` property. This property makes the element sticky while scrolling, so its values will be always 'sticky' for all freeze row & column.
If this caught your attention, see: Html Sticky Header
The `position: sticky` tag has good browser support, except for Internet Explorer, which doesn't support it. However, there are workarounds using JavaScript with CSS to make it work in IE.
You can also use JavaScript with CSS to freeze both rows and columns at the same time, as CSS can only block rows or columns separately. This involves using the `scrollTop` and `scrollLeft` functions to simulate the freeze during scrolling.
Here are some key features of a table with frozen rows and columns:
- Sticky Header: The table's header stays visible at the top when scrolling vertically.
- Frozen Left Column: The first column remains fixed as you scroll horizontally.
- Scrollable Content: Both vertical and horizontal scrolling are supported.
- Customizable Styles: The table design is clean and modern, with zebra striping and hover effects.
Freeze HTML Table Rows and Columns with CSS
You can freeze rows and columns in an HTML table using CSS. To make a row or column sticky while scrolling, you'll need to use the `position: sticky` property.
This property makes the element sticky while scrolling, so its values will always be 'sticky' for all freeze row & column.
Position: sticky is well supported in modern browsers like Chrome, Firefox, and Edge, but it won't work in Internet Explorer because IE doesn't support the `position: sticky` CSS tag.
Here's a list of some workarounds to make the sticky tag work in IE browser:
- Use JavaScript with CSS to make it happen.
- Check out the links below for more information:
- https://levelup.gitconnected.com/how-to-make-position-sticky-work-in-ie-build-your-own-css-polyfill-with-javascript-f42f0a3cc9ef
- https://css-tricks.com/stickybits-alternative-position-sticky-polyfills/
Block table first row with jQuery
To block the first row of an HTML table with jQuery, you'll need to use the scrollTop function to simulate the freeze of the row during scrolling. Unfortunately, CSS can only block rows or columns, not both at the same time.
CSS can't block both rows and columns simultaneously. To achieve this, you'll need to create a jQuery function that tricks the CSS.
To start, you'll need to identify the HTML table through an ID, for example . This will allow you to connect your HTML table with the scroll JavaScript event.
The scrollTop function returns the number of pixels of the scroll, which you can use to transport the header to the top based on the number of pixels on the axis Y. This will move the header up and down as you scroll.
You'll need to create a function that transports the first column on scroll, moving the column left and right on the axis X. This can be done using the scrollLeft function.
To assemble the code, you'll need to combine the JavaScript code with some CSS.
Additional reading: Do I Need Php for Submission Form Html
Table Structure and Features
The table structure used here is quite straightforward. We use a simple table structure with a for the header and a for the rows.
The table is wrapped in a div for scrollability, which is a great feature for tables with a lot of content. This allows the table to scroll both vertically and horizontally, making it easy to view and navigate.
Here are the key features of the table:
- Sticky Header: The table’s header stays visible at the top when scrolling vertically.
- Frozen Left Column: The first column remains fixed as you scroll horizontally.
- Scrollable Content: Both vertical and horizontal scrolling are supported.
- Customizable Styles: The table design is clean and modern, with zebra striping and hover effects.
Table Features
Table Features are a crucial part of any well-designed interface. The table's header stays visible at the top when scrolling vertically.
One of the standout features of this table is its ability to freeze the first column as you scroll horizontally. This keeps your data organized and easy to reference.
The table also supports both vertical and horizontal scrolling, making it easy to navigate even with large datasets. This is a game-changer for anyone who's ever struggled to view all their data at once.
Intriguing read: Is Html Easy

A clean and modern design is also a key feature of this table. The table design is customizable, with zebra striping and hover effects that make it visually appealing and easy to use.
Here's a summary of the table's key features:
- Sticky Header: The table’s header stays visible at the top when scrolling vertically.
- Frozen Left Column: The first column remains fixed as you scroll horizontally.
- Scrollable Content: Both vertical and horizontal scrolling are supported.
- Customizable Styles: The table design is clean and modern, with zebra striping and hover effects.
Structure
A well-structured table is key to making your data easy to read and understand. We use a simple table structure with a for the header.
The table is wrapped in a div for scrollability, which allows the user to scroll through the table without having to scroll the entire webpage.
Highlighting Column
Highlighting Column is a useful feature that allows you to draw attention to specific data in your table. The background color for the frozen column is set to red, with white text for better visibility.
You can customize this to match your design preferences. This feature is particularly helpful when you need to highlight important information or draw attention to a specific column.
The red background color is a standard choice, but you can change it to any color that suits your design needs. This customization option gives you the flexibility to make your table more visually appealing and easier to understand.
Intriguing read: Html Canvas Draw Svg
Sticky Header and Column
The sticky header is achieved using the position: sticky CSS property, which makes the element sticky while scrolling so its values will be always 'sticky' for all freeze row & column.
The position: sticky tag is supported by major browsers like Chrome, Firefox, Edge, etc., but not in Internet Explorer, which requires a JavaScript with CSS workaround to make it happen.
To make the header sticky in IE browser, you can use a JavaScript with CSS polyfill, such as the one found at https://levelup.gitconnected.com/how-to-make-position-sticky-work-in-ie-build-your-own-css-polyfill-with-javascript-f42f0a3cc9ef or https://css-tricks.com/stickybits-alternative-position-sticky-polyfills/.
The frozen column is styled using nth-child(1) selectors for and, with position: sticky and left: 0 properties to ensure the column stays in place while scrolling horizontally.
The z-index values differentiate the column's cell (5) and header (6) to ensure proper layering, and the background color for the frozen column is set to red, with white text for better visibility.
A different take: Set up Html Mail Using Word
How It Works
As you create an HTML table with a frozen column, the position: sticky header remains at the top of the .table-container when scrolling vertically.

The combination of overflow: auto and position: sticky is key to keeping the table functional and user-friendly, ensuring that the table remains accessible across both vertical and horizontal scrolling axes.
Scrolling horizontally creates a frozen column effect, where the leftmost column remains fixed in place.
This clever combination of CSS properties makes it easy to create a table that's both beautiful and user-friendly.
Readers also liked: Html Scrolling Text Box
Frequently Asked Questions
What does tr in HTML mean?
The HTML "tr" tag stands for "table row" and is used to define a row in an HTML table. It contains table data cells (td) and header cells (th).
Featured Images: pexels.com


