26 Feb 2019

Viewer does not stay in its container

Problem
When putting the Viewer inside a div container which is smaller than the document, then the Viewer spreads outside that container - see above image.

Solution
The Viewer is using position: absolute and “An absolute position based on the next non-static element up the control hierarchy. If no relative [or absolute - Adam] elements are defined on the document the position will be document relative - ie. global absolute.”
https://weblog.west-wind.com/posts/2008/Mar/28/Absolute-Positioning-inside-of-a-Relative-Element-with-CSS

So you just have to set your container's position to relative or absolute

Viewer staying inside its container

Related Article