I'm in the midst of developing a web application specifically for tablets. My goal is to display a modal dialog with a title bar and body that dynamically adjusts in height based on its content. If the content exceeds the viewport size, I want the dialog to have a scroll bar within the body and cap the maximum height at either the viewport's or parent's height. Is there a way to accomplish this using CSS/JS?