An HTML table with a fixed table header implemented with CSS

Source: Internet
Author: User
You've implemented an HTML table with a fixed header in your project, but you've used very bloated code because you're actually drawing three of the same tables. By chance, I found a table with a fixed table header that was implemented purely with HTML and CSS. The simplified code is summarized below.


original address see: http://www.imaputz.com/cssStuff/bulletVersion.html.


<html xmlns= "http://www.w3.org/1999/xhtml" xml:lang= "en" lang= "en" ><head>


<style type= "Text/css" >


<!--


Body {


background: #FFF;


color: #000;


font:normal normal 12px Verdana, Geneva, Arial, Helvetica, Sans-serif;


margin:10px;


padding:0


}





table, TD, a {


color: #000;


font:normal normal 12px Verdana, Geneva, Arial, Helvetica, Sans-serif


}





. TD


{


nowrap: ' true ';


}





Div.tablecontainer {


Clear:both;


border:1px solid #963;


height:285px;


Overflow:auto;


width:100%;


}





/* Winie 6.x needs to re-account for it ' s ScrollBar. Give it some padding * *


HTML div.tablecontainer/* * *


padding:0 16px 0 0


}





/* Clean up for allowing display Opera 5.x/6.x and Macie 5.x * *


html>body Div.tablecontainer {


Height:auto;


padding:0;


width:740px


}





/* Reset overflow value to hidden for all non-ie browsers. */


/* Filter out Opera 5.x/6.x and Macie 5.x * *


head:first-child+body Div[class].tablecontainer {


height:285px;


Overflow:hidden;


width:756px


}





/* Define width of table. IE Browsers only * *


/* If width is set to 100%, can remove the width */


/* Property from Div.tablecontainer and have the div scale * *


Div.tablecontainer Table {


Float:left;


width:100%


}





/* Winie 6.x needs to re-account for padding. Give it a negative margin * *


HTML div.tablecontainer table/* * *


margin:0 -16px 0 0


}





/* Define width of table. Opera 5.x/6.x and Macie 5.x * *


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.