0

Here is my example if you try to scroll down you will only get some content, and you can't view the last lines. How I might fix this?

div#scrollable {
    overflow-y: scroll;
    height: 100%;
    position: fixed;
    top: 100px;
}

I need:

  • Fixed div;
  • Offset of some value from the top;

Thanks

Totty.js
  • 15,563
  • 31
  • 103
  • 175

2 Answers2

3

Try the following:

div#scrollable {
    overflow-y: scroll;
    position: fixed;
    top: 100px;
    bottom: 0;
    width: 100%;
}

See demo: http://jsfiddle.net/audetwebdesign/a8dxhLra/

Marc Audet
  • 46,011
  • 11
  • 63
  • 83
0

A solution would be using some kind of a flexible layout to adjust the height inside the fixed element. Here's a solution using display: table.

It creates a pseudo 100px height row, that pushes the #scrollable div down, making it fill the remaining space on the table.

http://jsfiddle.net/AKL35/581/

#fixed-wrapper {
    position: fixed;
    display: table;
    height: 100%;
    width: 100%;
}

#fixed-wrapper:before {
    display: table-row;
    content: "";
    height: 100px;
}

div#scrollable {
    overflow-y: scroll;
    height: 100%;
}
LcSalazar
  • 16,524
  • 3
  • 37
  • 69