I\'m trying to use a ScrollPanel of GWT in a page. Since most of the contents are in the ScrollPanel, I want it to take an as-large-as-possible part of the page and resize a
The answer to your first question is very simple. When using the relative size for an element you are referring to the size of a parent element. So when you set height: 100%
it means that your element should be 100% size of its parent.
And there are some ways to get what you want:
use the Viewport-percentage lengths - you can set height: 100vh
which means 100% of the viewport height
- this is the easiest way but may be not yet supported by all browsers
set both the html
and body
elements 100% height - this will allow you to use the relative height on child elements
use GWT DockLayoutPanel or DockPanel and add your scroll panel to the center
pane - it will take all the remaining space