1

I am trying to fix the header of html table and scroll the rest of the table body. For fixing the column i am using the following css but the problem is that its disturbing the column size of the header .

    <style type="text/css">
      div.tableContainer 
       {
        clear: both;
        border: 1px solid #963;
        height: 300px;
        overflow: hidden;
        width: 1000px
       }

        html>body thead.fixedHeader tr 
        {
        display: block
       }


   thead.fixedHeader th 
    {

        background: #C96;
    border-left: 1px solid #EB8;
    border-right: 1px solid #B74;
    border-top: 1px solid #EB8;
    font-weight: normal;
    padding: 4px 3px;
    text-align: left
        position: relative
        width: 200px

    }

        html>body tbody.scrollContent {
        display: block;
        height: 300px;
        overflow: auto;
        width: 100%

       }

     tbody.scrollContent td, tbody.scrollContent tr.normalRow td {

        background: #FFF;
    border-bottom: none;
    border-left: none;
    border-right: 1px solid #CCC;
    border-top: 1px solid #DDD;
        padding: 2px 3px 3px 4px

      }

       html>body thead.fixedHeader th +th {
    width: 50px
       }


     </style>
adesh singh
  • 1,727
  • 9
  • 38
  • 70
  • 2
    Take a look at this thread, http://stackoverflow.com/questions/8232713/how-to-display-scroll-bar-onto-a-html-table – melc Oct 22 '13 at 07:38

3 Answers3

1

Related posts

1) Table with fixed header and fixed column on pure css

2) Scrollable table

3) How to display scroll bar onto a html table

4) Various Tables also there are some of them - with fixed header css you can find in html page if you inspect it

hope it would help you

Community
  • 1
  • 1
Def
  • 195
  • 7
0

Put the header in a separate table and the content in another, but position both the tables together so that it looks like one table.

<table>
put headers here.
</table>
<table>
put content here.
</table>
Wasiq Ali
  • 251
  • 2
  • 11
0

Try using css property overflow:overlay

Gaurav
  • 821
  • 9
  • 11