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

Posted By

Adam Nagy

Follow @AdamTheNagy Adam Nagy joined Autodesk back in 2005 and has been providing programming support, consulting, training and evangelism to external developers. He started his career in Budapest, then worked in Prague for 3 years and now lives in South England, UK. At the moment focusing on Inventor and Fusion 360, plus cloud and mobile related technologies. Adam has a degree in Software Engineering and has...