0

I have recently started front-end development and want to ask a couple of questions regarding CSS.

I have following table:

enter image description here

which both can be scrolled horizontal and vertical. It is styled using CSS:

<style type="text/css">
    th.col1 {
        width: 55px;
    }

    th.col2 {
        width: 45px;
    }

    th.col3 {
        width: 140px;
    }

    th.colROE {
        width: 50px;
    }

    th.col4 {
        width: 50px;
    }

    table tbody {
        overflow: auto;
        height: 700px;
        width: 900px;
    }        

    #scrollArea {
        overflow-x: scroll;
        width: 850px;
        height: 100%;
        padding-bottom: 20px;
    }

    #scrollArea {
        overflow-y: scroll;
        height: 850px;
        width: 100%;
        padding-bottom: 20px;
    }

    .ddlWidth {
        width: 100px;
    }

    #listcollection {
        width: 100%;
    }

    #municipalityTable {
        padding-left: 10px;
    }

    .CvrTextbox, .KommuneTextbox {
        width: 50px;
    }

    .EmailTextbox {
        width: 120px;
    }
</style>

and since the table supports both horizontal and vertical scrolling, I cannot use the "position: absolute" property in CSS, since I only want the header to freeze during a vertical scrolling but NOT during a horizontal scrolling. I want to ask for any advices to obtain my requirement. Can I obtain this in CSS, or should I use JavaScript ?.

Meiko Rachimow
  • 4,664
  • 2
  • 25
  • 43
Osman Esen
  • 1,704
  • 2
  • 21
  • 46
  • I guess you are looking for overflow-x: none; in thead but without seeing also html is hard to say – silviagreen Mar 08 '16 at 09:15
  • That property does not have any affect on thead if I use position:absolute – Osman Esen Mar 08 '16 at 09:27
  • Possible duplicate of [Fixed header table with horizontal scrollbar and vertical scrollbar on](http://stackoverflow.com/questions/14977864/fixed-header-table-with-horizontal-scrollbar-and-vertical-scrollbar-on) – Roy Mar 08 '16 at 09:30

0 Answers0