HTML table Fixed Header, htmltable fixed table

Source: Internet
Author: User

HTML table Fixed Header, htmltable fixed table

Recently I tried several methods to fix the table header in HTML... the difference... has its own advantages and disadvantages, but it is embarrassing .....

1. Set display of thead and tbody to block;

This can be achieved, but you need to set the width of each th and td in advance. Otherwise, the th and the corresponding td will be staggered and cannot be aligned;

2. Use two tables for simulation. The first is thead, and the second is tbody;

The cell width needs to be dynamically set to basically meet the needs, but in firefox, there will be a slight flaw, and the cell border will be staggered a little;

3. A good method found on <front-end stew> is very useful today. The scrollTop attribute of thead is dynamically set using transform.

The simulated Fixed Header is much easier than the first two methods, and the result is also very good;

Below is the original article link:

Http://www.html-js.com/article/cssyanjiu-css3shixiangudingbiaogetoubuerwuxushezhidanyuangetddikuandu%204019

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.