Home Web Front-end HTML Tutorial css controls fixed header, compatible with row and column merging_html/css_WEB-ITnose

css controls fixed header, compatible with row and column merging_html/css_WEB-ITnose

Jun 24, 2016 am 11:51 AM

The report table design designed in the project has relatively too many columns. When dragging the scroll bar below, it cannot correspond to the column corresponding to the table header, so I searched online for a long time, and finally I found some reference materials on the Internet, and then summarized a fixed header demo that is compatible with row and column merging.

Multiple browsers have not done much testing, and it has been tested in ie6.

I have been waiting for this function for a long time and finally found a solution today. I have summarized it in javaeye for easy reference in the future. There may be better implementation methods. I hope some experts will pass by and leave me some better implementation examples for future communication.

The following is the relevant css

Html code

  1. >
  2. Html code
    1. 利用CSS代码让Table产生固定表头

        
    2.   
    3.   
    4.       
    5.   
    6.      
    7.   列头  
    8.   列头  
    9.   列头  
    10.   
    11.   
    12.   h1  
    13.   h2  
    14.   h3  
    15.   h4  
    16.   h5  
    17.   
    18.   
    19.   
    20.     
    21.       
    22.     a  
    23.   单元格2  
    24.   单元格3  
    25.   单元格4  
    26.   单元格5  
    27.   单元格5  
    28.   
    29.   
    30.     
    31.       
    32.     b  
    33.   单元格2  
    34.   单元格3  
    35.   单元格4  
    36.   单元格5  
    37.   单元格5  
    38.   
    39.   
    40.     
    41.       
    42.     c  
    43.   单元格2  
    44.   单元格3  
    45.   单元格4  
    46.   单元格5  
    47.   单元格5  
    48.   
    49.   
    50.     
    51.       
    52.     d  
    53.   单元格2  
    54.   单元格3  
    55. Cell 4
    56. Cell 5
    57. Cell 5
    58. ="checkbox5" value="checkbox">
    59. e
    60. Cell 2 Cell 3
    61. Cell 4 Cell 5
    62. f
    63. Cell 2
    64. Cell 3
    65. Cell 4
    66. Cell 5
    67. Cell 5
    68. g
    69. Cell 2
    70. Cell 3
    71. Cell 4
    72. Cell 5
  • In addition, if the last row is merged in the table header, there will be problems with typesetting. Since there are only two lines merged above, the style has not been changed. If you want to deal with it, the temporary solution is not to merge the last line of rowspan and display it in multiple lines. This is a bit far-fetched, but I can't find a solution. A similar situation is as shown below:
  • I found some information for reference:
  • http://www.loveayang.com.cn/post/2008/04/e59bbae5ae9ae8a1a8e5a4b4e79a84CSSe5ae9ee78eb0.aspx
  • The article also said that there is no way to solve the above problem, leaving it to be better solved in the future.








  • Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

    Hot AI Tools

    Undresser.AI Undress

    Undresser.AI Undress

    AI-powered app for creating realistic nude photos

    AI Clothes Remover

    AI Clothes Remover

    Online AI tool for removing clothes from photos.

    Undress AI Tool

    Undress AI Tool

    Undress images for free

    Clothoff.io

    Clothoff.io

    AI clothes remover

    AI Hentai Generator

    AI Hentai Generator

    Generate AI Hentai for free.

    Hot Article

    R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
    1 months ago By 尊渡假赌尊渡假赌尊渡假赌
    R.E.P.O. Best Graphic Settings
    1 months ago By 尊渡假赌尊渡假赌尊渡假赌
    Will R.E.P.O. Have Crossplay?
    1 months ago By 尊渡假赌尊渡假赌尊渡假赌

    Hot Tools

    Notepad++7.3.1

    Notepad++7.3.1

    Easy-to-use and free code editor

    SublimeText3 Chinese version

    SublimeText3 Chinese version

    Chinese version, very easy to use

    Zend Studio 13.0.1

    Zend Studio 13.0.1

    Powerful PHP integrated development environment

    Dreamweaver CS6

    Dreamweaver CS6

    Visual web development tools

    SublimeText3 Mac version

    SublimeText3 Mac version

    God-level code editing software (SublimeText3)

    What is the purpose of the <progress> element? What is the purpose of the <progress> element? Mar 21, 2025 pm 12:34 PM

    The article discusses the HTML &lt;progress&gt; element, its purpose, styling, and differences from the &lt;meter&gt; element. The main focus is on using &lt;progress&gt; for task completion and &lt;meter&gt; for stati

    What is the purpose of the <datalist> element? What is the purpose of the <datalist> element? Mar 21, 2025 pm 12:33 PM

    The article discusses the HTML &lt;datalist&gt; element, which enhances forms by providing autocomplete suggestions, improving user experience and reducing errors.Character count: 159

    What is the purpose of the <meter> element? What is the purpose of the <meter> element? Mar 21, 2025 pm 12:35 PM

    The article discusses the HTML &lt;meter&gt; element, used for displaying scalar or fractional values within a range, and its common applications in web development. It differentiates &lt;meter&gt; from &lt;progress&gt; and ex

    What is the viewport meta tag? Why is it important for responsive design? What is the viewport meta tag? Why is it important for responsive design? Mar 20, 2025 pm 05:56 PM

    The article discusses the viewport meta tag, essential for responsive web design on mobile devices. It explains how proper use ensures optimal content scaling and user interaction, while misuse can lead to design and accessibility issues.

    What is the purpose of the <iframe> tag? What are the security considerations when using it? What is the purpose of the <iframe> tag? What are the security considerations when using it? Mar 20, 2025 pm 06:05 PM

    The article discusses the &lt;iframe&gt; tag's purpose in embedding external content into webpages, its common uses, security risks, and alternatives like object tags and APIs.

    Is HTML easy to learn for beginners? Is HTML easy to learn for beginners? Apr 07, 2025 am 12:11 AM

    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.

    The Roles of HTML, CSS, and JavaScript: Core Responsibilities The Roles of HTML, CSS, and JavaScript: Core Responsibilities Apr 08, 2025 pm 07:05 PM

    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.

    What is an example of a starting tag in HTML? What is an example of a starting tag in HTML? Apr 06, 2025 am 12:04 AM

    AnexampleofastartingtaginHTMLis,whichbeginsaparagraph.StartingtagsareessentialinHTMLastheyinitiateelements,definetheirtypes,andarecrucialforstructuringwebpagesandconstructingtheDOM.

    See all articles