


Browser compatibility issues for CSS to implement scrollable tables with fixed headers_html/css_WEB-ITnose
I want to make a table with a fixed header and a scrollable table body. An example found from the Internet is as follows:
http://www.imaputz.com/cssStuff/bigFourVersion.html
http://stackoverflow.com/questions/13043837/scrollable-table-with- fixed-header
After adjustment, it works well in Firefox, Chrome and IE10, but not in IE8, IE9 and IE11. The symptom is that the tboytboy part cannot be scrolled (no scroll bar). The container outside the table can have scroll bars, but the table header will scroll together with the table body.
Is there any good way to solve this browser compatibility issue? Thanks!
(Take a week off from tomorrow, check out when you come back)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Untitled Document</title><style>*{ margin:0; padding:0; }div.tableContainer { clear: both; border: 0px solid #963; height: 420px; /* html>body tbody.scrollContent height plus 23px for the header */ overflow: auto; width: 756px /* Remember to leave 16px for the scrollbar! */}/* define width of table. IE browsers only */div.tableContainer table { float: left; width: 740px; border-collapse:collapse; border: 1px solid #76a0ae; background-color: #ddd2e5;}div.tableContainer table tr{ height:33px;}/*html>body */tbody.scrollContent { margin-top:10px; display: block; height: 352px; overflow: auto; width: 100%; background-color: #eeeeee;}tbody td { height: 32px;}/*html>body */thead.fixedHeader tr { display: block; background-color: #ddd2e5;}/*html>body */thead.fixedHeader th { /* TH 1 */ border: 1px solid #76a0ae; width: 180px; height:40px;}/*html>body */thead.fixedHeader th + th { /* TH 2 */ width: 240px;}/*html>body */thead.fixedHeader th + th + th { /* TH 3 +16px for scrollbar */ width: 336px;}/*html>body */tbody.scrollContent td { /* TD 1 */ border: 1px solid #76a0ae; width: 180px; height:33px;}/*html>body */tbody.scrollContent td + td { /* TD 2 */ width: 240px;}/*html>body */tbody.scrollContent td + td + td { /* TD 3 +16px for scrollbar */ width: 320px;}</style></head><body><h1>Pure CSS Scrollable Table with Fixed Header</h1><p>Using CSS to allow scrolling within a single HTML table</p><br /><br /><div id="tableContainer" class="tableContainer"><table width="100%" cellspacing="0" cellpadding="0" border="0" class="scrollTable"> <thead class="fixedHeader"> <tr class="alternateRow"> <th><a href="#">Header 1</a></th> <th><a href="#">Header 2</a></th> <th><a href="#">Header 3</a></th> </tr> </thead> <tbody class="scrollContent"> <tr> <td>Cell Content 1 1</td> <td>Cell Content 1 2</td> <td>Cell Content 1 3</td> </tr> <tr> <td>Cell Content 2 1</td> <td>Cell Content 2 2</td> <td>Cell Content 2 3</td> </tr> <tr> <td>Cell Content 3 1</td> <td>Cell Content 3 2</td> <td>Cell Content 3 3</td> </tr> <tr> <td>Cell Content 4 1</td> <td>Cell Content 4 2</td> <td>Cell Content 4 3</td> </tr> <tr> <td>Cell Content 5 1</td> <td>Cell Content 5 2</td> <td>Cell Content 5 3</td> </tr> <tr> <td>Cell Content 6 1</td> <td>Cell Content 6 2</td> <td>Cell Content 6 3</td> </tr> <tr> <td>Cell Content 7 1</td> <td>Cell Content 7 2</td> <td>Cell Content 7 3</td> </tr> <tr> <td>Cell Content 8 1</td> <td>Cell Content 8 2</td> <td>Cell Content 8 3</td> </tr> <tr> <td>Cell Content 9 1</td> <td>Cell Content 9 2</td> <td>Cell Content 9 3</td> </tr> <tr> <td>Cell Content 10 1</td> <td>Cell Content 10 2</td> <td>Cell Content 10 3</td> </tr> <tr> <td>Cell Content 11 1</td> <td>Cell Content 11 2</td> <td>Cell Content 11 3</td> </tr> <tr> <td>Cell Content 12 1</td> <td>Cell Content 12 2</td> <td>Cell Content 12 3</td> </tr> <tr> <td>Cell Content 13 1</td> <td>Cell Content 13 2</td> <td>Cell Content 13 3</td> </tr> <tr> <td>Cell Content 14 1</td> <td>Cell Content 14 2</td> <td>Cell Content 14 3</td> </tr> <tr> <td>Cell Content 15 1</td> <td>Cell Content 15 2</td> <td>Cell Content 15 3</td> </tr> </tbody></table></div></body></html>
Reply to discussion (solution)
No one replied . Is the question too difficult, or is my character too poor?
Completely copy the table
Scroll one below
Wrap a div on the outside and only show the table header and stack it on top
Thank you KK3K2005 for your enthusiastic reply!
Using two identical tables? Can you go into more detail? I use it in ASP.NET web pages.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



HTML is suitable for beginners because it is simple and easy to learn and can quickly see results. 1) The learning curve of HTML is smooth and easy to get started. 2) Just master the basic tags to start creating web pages. 3) High flexibility and can be used in combination with CSS and JavaScript. 4) Rich learning resources and modern tools support the learning process.

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

AnexampleofastartingtaginHTMLis,whichbeginsaparagraph.StartingtagsareessentialinHTMLastheyinitiateelements,definetheirtypes,andarecrucialforstructuringwebpagesandconstructingtheDOM.

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

GiteePages static website deployment failed: 404 error troubleshooting and resolution when using Gitee...

The Y-axis position adaptive algorithm for web annotation function This article will explore how to implement annotation functions similar to Word documents, especially how to deal with the interval between annotations...

To achieve the effect of scattering and enlarging the surrounding images after clicking on the image, many web designs need to achieve an interactive effect: click on a certain image to make the surrounding...

The necessity of registering VueRouter in the index.js file under the router folder When developing Vue applications, you often encounter problems with routing configuration. Special...
