Gerson Macedo
Gerson Macedo

Reputation: 33

Table with fixed column and scroll

Im trying to do a table with fixed column and scrolls like the following link: http://hazaa.com.au/blog/how-to-create-an-html-table-with-frozen-headers-and-columns/

Source code:https://onedrive.live.com/?cid=5e237543fffb2891&id=5E237543FFFB2891%21192

The point is that in this sample, the table have fixed width and heights in "px", and im needed that table fits according to the screen (replace the fixed "px" to "%").

Can someone help me on that? When i make the changes, i'm really can't bring up the vertical scroll!!

Thanks!!

Upvotes: 0

Views: 121

Answers (1)

user4639281
user4639281

Reputation:

Put a div inside the columns, text inside the div. Set height:100% on everything (especially html and body), width: 100% on the table and overflow: auto on the div

(Demo)

html,body {
    padding: 0;
    margin: 0;
    height: 100%;
}
table {
    width: 100%;
    height: 100%;
}
div {
    height: 100%;
    overflow: auto;
}

Upvotes: 1

Related Questions