title: Flexible centered dialog using flexbox with a scrolling region
body: <p><em>TL;DR - if your looking for the quick copy/paste answer, the code is at the bottom of this question.</em></p>
  
  <p>I've been trying now for at least a day, to try and get a flexbox dialog I'm creating to clip/scroll it's content correctly.</p>
  
  <p>Essentially what I'm trying to create is this:</p>
  
  <p><a href="https://i.stack.imgur.com/CWoCC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CWoCC.png" alt="enter image description here"></a></p>
  
  <p>The dialog overlay (Shaded screen) is 100vh/100vw and z-ordered to sit in front of any content already on the page, it's set to display:flex with centering, so that it's ONLY child (the dialog box) always sits in the center of the page no matter what size it is, the 2 css rules to make this happen are as follows:</p>
  
  <pre><code>.dialogOverlay {
      z-index: 600;
      position: absolute;
      left: 0;
      top: 0;
      height: 100vh;
      width: 100vw;
      background-color: rgba(0,0,0,0.4);
      display: flex;
      justify-content: center;
      align-items: center;
  }
  
  .dialogBase {
      position: relative;
      min-width: 120px;
      min-height: 120px;
      max-width: 75%;
      max-height: 75%;
      overflow: hidden;
      background-color: white;
      border: 1px solid black;
      z-index: 601;
  }
  </code></pre>
  
  <p>The size of the dialog has a minimum of 120px by 120px and is not allowed to grow to more than 75% of the width or height of the page.</p>
  
  <p>This bit all works great, and as anticipated once the dialog reaches maximum size any overflowing content is hidden.</p>
  
  <p>Inside the "dialogBase" there is a dialog content body, and this is set to display:flex, so that it's 2 children (The title bar and the content area) are stacked in row order on top of each other.</p>
  
  <p>The title bar has a fixed height and is also a flex container (As it has 3 children, title text and 2 icons).</p>
  
  <p>The remaining dialog body is flex: 1 so that it uses the remaining space and again this all works perfectly fine.  If I fill the dialog body with content it forces the size of the dialog to stretch to accommodate, and at max size hides the content.</p>
  
  <p>The CSS for these items is as follows:</p>
  
  <pre><code>.dialogContentBody {
      z-index: 602;
      display: flex;
      -ms-flex-direction: column;
      -webkit-flex-direction: column;
      flex-direction: column;
  }
  
      .dialogContentBody .titleBar {
          background-color: #6e6e6e;
          color: white;
          height: 50px;
          width: 100%;
          border-bottom: 1px solid black;
          display: flex;
          align-items: center;
          justify-content: center;
      }
  
      .dialogContentBody .bodyContent {
          overflow-y: scroll;
          background-color: yellow;
          flex: 1;
      }
  </code></pre>
  
  <p>The problem however is that I want the body content to scroll once the y direction reaches maximum height, as there are times when the content added into "bodyContent" WILL cause an overflow, however no matter how hard I try, I cannot in any way get the overflow to give me a scroll bar.</p>
  
  <p>For now I'd settle for body content being y scrollable, however ultimately what I want to achieve, is to have a full width/height div for the body content area, which has a fixed width side bar, with a flex 1 content area that is scrollable.</p>
  
  <p>The HTML I've been using so far is:</p>
  
  <pre><code>&lt;div class="dialogOverlay" data-bind="visible: isOpen"&gt;
  
      &lt;div class="dialogBase"&gt;
  
              &lt;div class="dialogContentOverlay" data-bind="visible: isBlocked"&gt;
                  &lt;loadspinner params="{fontAwesomeSize: 5}"&gt;&lt;/loadspinner&gt;
              &lt;/div&gt;
  
              &lt;div class="dialogContentBody"&gt;
  
                  &lt;div class="titleBar"&gt;
                      &lt;div class="titleContent" data-bind="text: pageTitle"&gt;&lt;/div&gt;
                      &lt;div class="iconContent okIcon"&gt;
                          &lt;i class="fa fa-check-circle" data-bind="click: handleOkButton"&gt;&lt;/i&gt;
                      &lt;/div&gt;
                      &lt;div class="iconContent closeIcon"&gt;
                          &lt;i class="fa fa-times-circle" data-bind="click: handleCloseButton"&gt;&lt;/i&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
  
                  &lt;div class="bodyContent" data-bind="component: { name: bodyContentComponentName , params: bodyContentComponentParams}"&gt;&lt;/div&gt;
  
              &lt;/div&gt;
  
      &lt;/div&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>Warning</strong> <em>Yes, they are knockout 'data-binds' on the HTML as I'm using a KO component architecture here, the "bodyContentComponentName" will eventually be the inner content I'm talking about and will be injected from a stand alone component set.  For now however, we can just imagine there is other content inside that div.</em></p>
  
  <p>The one thing I do know, is that the 'overflow: hidden' absolutley MUST be kept on "dialogBase" as everything just overflows to the base of the screen if not.</p>
  
  <p>Interestingly enough however, if the hidden overflow is removed, and the content is allowed to spill out of the dialog to the bottom of the screen, any overflow scrolls in the content still don't work correctly.</p>
  
  <p>Any help anyone can give, or any ideas on making this work are greatly appreciated.</p>
  
  <p>Shawty</p>
  
  <h1>Update (about 10 mins later)</h1>
  
  <p>Evan <strong>IF</strong> I reduce things to the following most simple possible case with a fixed height of 500px, I still cannot get the dialog body to scroll:</p>
  
  <pre><code>&lt;style&gt;
      .dialogOverlay {
          z-index: 600;
          position: absolute;
          left: 0;
          top: 0;
          height: 100vh;
          width: 100vw;
          background-color: rgba(0,0,0,0.4);
          display: flex;
          justify-content: center;
          align-items: center;
      }
  
      .dialogBase {
          position: relative;
          min-width: 120px;
          max-width: 75%;
          overflow: hidden;
          height: 500px;
          background-color: white;
          border: 1px solid black;
          margin: 10px;
          z-index: 601;
      }
  
      .bodyContent {
          background-color: yellow;
          overflow-y: scroll;
      }
  
  &lt;/style&gt;
  
  &lt;div class="dialogOverlay" data-bind="visible: isOpen"&gt;
  
      &lt;div class="dialogBase"&gt;
  
          &lt;div class="bodyContent" data-bind="compinent: { name: bodyContentComponentName , params: bodyContentComponentParams}"&gt;
              &lt;h1&gt;Body content, Body Content&lt;/h1&gt;
              &lt;p&gt;body content&lt;/p&gt;
              &lt;h1&gt;Body content, Body Content&lt;/h1&gt;
              &lt;p&gt;body content&lt;/p&gt;
              &lt;h1&gt;Body content, Body Content&lt;/h1&gt;
              &lt;p&gt;body content&lt;/p&gt;
              &lt;h1&gt;Body content, Body Content&lt;/h1&gt;
              &lt;p&gt;body content&lt;/p&gt;
              &lt;h1&gt;Body content, Body Content&lt;/h1&gt;
              &lt;p&gt;body content&lt;/p&gt;
              &lt;h1&gt;Body content, Body Content&lt;/h1&gt;
              &lt;p&gt;body content&lt;/p&gt;
              &lt;h1&gt;Body content, Body Content&lt;/h1&gt;
              &lt;p&gt;body content&lt;/p&gt;
              &lt;h1&gt;Body content, Body Content&lt;/h1&gt;
              &lt;p&gt;body content&lt;/p&gt;
              &lt;h1&gt;Body content, Body Content&lt;/h1&gt;
              &lt;p&gt;body content&lt;/p&gt;
              &lt;h1&gt;Body content, Body Content&lt;/h1&gt;
              &lt;p&gt;body content&lt;/p&gt;
              &lt;h1&gt;Body content, Body Content&lt;/h1&gt;
              &lt;p&gt;body content&lt;/p&gt;
              &lt;h1&gt;Body content, Body Content&lt;/h1&gt;
              &lt;p&gt;body content&lt;/p&gt;
              &lt;h1&gt;Body content, Body Content&lt;/h1&gt;
              &lt;p&gt;body content&lt;/p&gt;
              &lt;h1&gt;Body content, Body Content&lt;/h1&gt;
              &lt;p&gt;body content&lt;/p&gt;
              &lt;h1&gt;Body content, Body Content&lt;/h1&gt;
              &lt;p&gt;body content&lt;/p&gt;
              &lt;h1&gt;Body content, Body Content&lt;/h1&gt;
              &lt;p&gt;body content&lt;/p&gt;
              &lt;h1&gt;Body content, Body Content&lt;/h1&gt;
              &lt;p&gt;body content&lt;/p&gt;
              &lt;h1&gt;Body content, Body Content&lt;/h1&gt;
              &lt;p&gt;body content&lt;/p&gt;
              &lt;h1&gt;Body content, Body Content&lt;/h1&gt;
              &lt;p&gt;body content&lt;/p&gt;
              &lt;h1&gt;Body content, Body Content&lt;/h1&gt;
              &lt;p&gt;body content&lt;/p&gt;
              &lt;h1&gt;Body content, Body Content&lt;/h1&gt;
              &lt;p&gt;body content&lt;/p&gt;
              &lt;h1&gt;Body content, Body Content&lt;/h1&gt;
              &lt;p&gt;body content&lt;/p&gt;
              &lt;h1&gt;Body content, Body Content&lt;/h1&gt;
              &lt;p&gt;body content&lt;/p&gt;
              &lt;h1&gt;Body content, Body Content&lt;/h1&gt;
              &lt;p&gt;body content&lt;/p&gt;
              &lt;h1&gt;Body content, Body Content&lt;/h1&gt;
              &lt;p&gt;body content&lt;/p&gt;
              &lt;h1&gt;Body content, Body Content&lt;/h1&gt;
              &lt;p&gt;body content&lt;/p&gt;
              &lt;h1&gt;Body content, Body Content&lt;/h1&gt;
              &lt;p&gt;body content&lt;/p&gt;
              &lt;h1&gt;Body content, Body Content&lt;/h1&gt;
              &lt;p&gt;body content&lt;/p&gt;
              &lt;h1&gt;Body content, Body Content&lt;/h1&gt;
              &lt;p&gt;body content&lt;/p&gt;
              &lt;h1&gt;Body content, Body Content&lt;/h1&gt;
              &lt;p&gt;body content&lt;/p&gt;
              &lt;h1&gt;Body content, Body Content&lt;/h1&gt;
              &lt;p&gt;body content&lt;/p&gt;
              &lt;h1&gt;Body content, Body Content&lt;/h1&gt;
              &lt;p&gt;body content&lt;/p&gt;
              &lt;h1&gt;Body content, Body Content&lt;/h1&gt;
              &lt;p&gt;body content&lt;/p&gt;
              &lt;h1&gt;Body content, Body Content&lt;/h1&gt;
              &lt;p&gt;body content&lt;/p&gt;
              &lt;h1&gt;Body content, Body Content&lt;/h1&gt;
              &lt;p&gt;body content&lt;/p&gt;
              &lt;h1&gt;Body content, Body Content&lt;/h1&gt;
              &lt;p&gt;body content&lt;/p&gt;
              &lt;h1&gt;Body content, Body Content&lt;/h1&gt;
              &lt;p&gt;body content&lt;/p&gt;
              &lt;h1&gt;Body content, Body Content&lt;/h1&gt;
              &lt;p&gt;body content&lt;/p&gt;
              &lt;h1&gt;Body content, Body Content&lt;/h1&gt;
              &lt;p&gt;body content&lt;/p&gt;
              &lt;h1&gt;Body content, Body Content&lt;/h1&gt;
              &lt;p&gt;body content&lt;/p&gt;
              &lt;h1&gt;Body content, Body Content&lt;/h1&gt;
              &lt;p&gt;body content&lt;/p&gt;
              &lt;h1&gt;Body content, Body Content&lt;/h1&gt;
              &lt;p&gt;body content&lt;/p&gt;
          &lt;/div&gt;
  
      &lt;/div&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <h1>Update following Micheal_B's answer</h1>
  
  <p>Adding 100% to the doc body still did not enable the scroll bar</p>
  
  <pre><code>&lt;style&gt;
      .dialogOverlay {
          z-index: 600;
          position: absolute;
          left: 0;
          top: 0;
          height: 100vh;
          width: 100vw;
          background-color: rgba(0,0,0,0.4);
          display: flex;
          justify-content: center;
          align-items: center;
      }
  
      .dialogBase {
          position: relative;
          min-width: 120px;
          //min-height: 120px;
          max-width: 75%;
          //max-height: 75%;
          overflow: hidden;
          height: 500px;
          background-color: white;
          border: 1px solid black;
          margin: 10px;
          z-index: 601;
      }
  
      .dialogContentBody {
          z-index: 602;
          display: flex;
          -ms-flex-direction: column;
          -webkit-flex-direction: column;
          flex-direction: column;
      }
  
  
          .bodyContent {
              //padding: 100px;
              //overflow: hidden;
              background-color: yellow;
              flex: 1;
              overflow-y: scroll;
              height: 100%;
          }
  
              .dialogConAtentBody .bodyContent:empty {
                  display: none;
              }
  &lt;/style&gt;
  
  &lt;div class="dialogOverlay" data-bind="visible: isOpen"&gt;
  
      &lt;div class="dialogBase"&gt;
  
              &lt;div class="dialogContentBody"&gt;
  
                  &lt;div class="bodyContent" data-bind="compinent: { name: bodyContentComponentName , params: bodyContentComponentParams}"&gt;
                      &lt;h1&gt;Test Contnet, Test Content&lt;/h1&gt;
                      &lt;p&gt;test content&lt;/p&gt;
                      &lt;h1&gt;Test Contnet, Test Content&lt;/h1&gt;
                      &lt;p&gt;test content&lt;/p&gt;
                      &lt;h1&gt;Test Contnet, Test Content&lt;/h1&gt;
                      &lt;p&gt;test content&lt;/p&gt;
                      &lt;h1&gt;Test Contnet, Test Content&lt;/h1&gt;
                      &lt;p&gt;test content&lt;/p&gt;
                      &lt;h1&gt;Test Contnet, Test Content&lt;/h1&gt;
                      &lt;p&gt;test content&lt;/p&gt;
                      &lt;h1&gt;Test Contnet, Test Content&lt;/h1&gt;
                      &lt;p&gt;test content&lt;/p&gt;
                      &lt;h1&gt;Test Contnet, Test Content&lt;/h1&gt;
                      &lt;p&gt;test content&lt;/p&gt;
                      &lt;h1&gt;Test Contnet, Test Content&lt;/h1&gt;
                      &lt;p&gt;test content&lt;/p&gt;
                      &lt;h1&gt;Test Contnet, Test Content&lt;/h1&gt;
                      &lt;p&gt;test content&lt;/p&gt;
                      &lt;h1&gt;Test Contnet, Test Content&lt;/h1&gt;
                      &lt;p&gt;test content&lt;/p&gt;
                      &lt;h1&gt;Test Contnet, Test Content&lt;/h1&gt;
                      &lt;p&gt;test content&lt;/p&gt;
                      &lt;h1&gt;Test Contnet, Test Content&lt;/h1&gt;
                      &lt;p&gt;test content&lt;/p&gt;
                      &lt;h1&gt;Test Contnet, Test Content&lt;/h1&gt;
                      &lt;p&gt;test content&lt;/p&gt;
                      &lt;h1&gt;Test Contnet, Test Content&lt;/h1&gt;
                      &lt;p&gt;test content&lt;/p&gt;
                      &lt;h1&gt;Test Contnet, Test Content&lt;/h1&gt;
                      &lt;p&gt;test content&lt;/p&gt;
                      &lt;h1&gt;Test Contnet, Test Content&lt;/h1&gt;
                      &lt;p&gt;test content&lt;/p&gt;
                      &lt;h1&gt;Test Contnet, Test Content&lt;/h1&gt;
                      &lt;p&gt;test content&lt;/p&gt;
                      &lt;h1&gt;Test Contnet, Test Content&lt;/h1&gt;
                      &lt;p&gt;test content&lt;/p&gt;
                      &lt;h1&gt;Test Contnet, Test Content&lt;/h1&gt;
                      &lt;p&gt;test content&lt;/p&gt;
                      &lt;h1&gt;Test Contnet, Test Content&lt;/h1&gt;
                      &lt;p&gt;test content&lt;/p&gt;
                      &lt;h1&gt;Test Contnet, Test Content&lt;/h1&gt;
                      &lt;p&gt;test content&lt;/p&gt;
                      &lt;h1&gt;Test Contnet, Test Content&lt;/h1&gt;
                      &lt;p&gt;test content&lt;/p&gt;
                      &lt;h1&gt;Test Contnet, Test Content&lt;/h1&gt;
                      &lt;p&gt;test content&lt;/p&gt;
                      &lt;h1&gt;Test Contnet, Test Content&lt;/h1&gt;
                      &lt;p&gt;test content&lt;/p&gt;
                      &lt;h1&gt;Test Contnet, Test Content&lt;/h1&gt;
                      &lt;p&gt;test content&lt;/p&gt;
                      &lt;h1&gt;Test Contnet, Test Content&lt;/h1&gt;
                      &lt;p&gt;test content&lt;/p&gt;
                      &lt;h1&gt;Test Contnet, Test Content&lt;/h1&gt;
                      &lt;p&gt;test content&lt;/p&gt;
                      &lt;h1&gt;Test Contnet, Test Content&lt;/h1&gt;
                      &lt;p&gt;test content&lt;/p&gt;
                      &lt;h1&gt;Test Contnet, Test Content&lt;/h1&gt;
                      &lt;p&gt;test content&lt;/p&gt;
                      &lt;h1&gt;Test Contnet, Test Content&lt;/h1&gt;
                      &lt;p&gt;test content&lt;/p&gt;
                      &lt;h1&gt;Test Contnet, Test Content&lt;/h1&gt;
                      &lt;p&gt;test content&lt;/p&gt;
                      &lt;h1&gt;Test Contnet, Test Content&lt;/h1&gt;
                      &lt;p&gt;test content&lt;/p&gt;
                      &lt;h1&gt;Test Contnet, Test Content&lt;/h1&gt;
                      &lt;p&gt;test content&lt;/p&gt;
                      &lt;h1&gt;Test Contnet, Test Content&lt;/h1&gt;
                      &lt;p&gt;test content&lt;/p&gt;
                      &lt;h1&gt;Test Contnet, Test Content&lt;/h1&gt;
                      &lt;p&gt;test content&lt;/p&gt;
                      &lt;h1&gt;Test Contnet, Test Content&lt;/h1&gt;
                      &lt;p&gt;test content&lt;/p&gt;
                      &lt;h1&gt;Test Contnet, Test Content&lt;/h1&gt;
                      &lt;p&gt;test content&lt;/p&gt;
                      &lt;h1&gt;Test Contnet, Test Content&lt;/h1&gt;
                      &lt;p&gt;test content&lt;/p&gt;
                      &lt;h1&gt;Test Contnet, Test Content&lt;/h1&gt;
                      &lt;p&gt;test content&lt;/p&gt;
                      &lt;h1&gt;Test Contnet, Test Content&lt;/h1&gt;
                      &lt;p&gt;test content&lt;/p&gt;
                      &lt;h1&gt;Test Contnet, Test Content&lt;/h1&gt;
                      &lt;p&gt;test content&lt;/p&gt;
                      &lt;h1&gt;Test Contnet, Test Content&lt;/h1&gt;
                      &lt;p&gt;test content&lt;/p&gt;
                      &lt;h1&gt;Test Contnet, Test Content&lt;/h1&gt;
                      &lt;p&gt;test content&lt;/p&gt;
                      &lt;h1&gt;Test Contnet, Test Content&lt;/h1&gt;
                      &lt;p&gt;test content&lt;/p&gt;
                  &lt;/div&gt;
  
              &lt;/div&gt;
  
      &lt;/div&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <h1>More updates</h1>
  
  <p>With micheal b's help, I got the container to scroll with the height fixed at 500px, unfortunately even when reverting back to min/max flex height the scrolling still does not work.  I've also since traced the container back up the chain to HTML and there is a fixed "height: 100%" on every element all the way back up to the top.</p>
  
  <p><strong>This one does not work</strong></p>
  
  <pre><code>&lt;style&gt;
      .dialogOverlay {
          z-index: 600;
          position: absolute;
          left: 0;
          top: 0;
          height: 100vh;
          width: 100vw;
          background-color: rgba(0,0,0,0.4);
          display: flex;
          justify-content: center;
          align-items: center;
      }
  
      .dialogBase {
          position: relative;
          min-width: 120px;
          min-height: 120px;
          max-width: 75%;
          max-height: 75%;
          overflow: hidden;
          background-color: white;
          border: 1px solid black;
          margin: 10px;
          z-index: 601;
      }
  
      .dialogContentBody {
          z-index: 602;
          display: flex;
          -ms-flex-direction: column;
          -webkit-flex-direction: column;
          flex-direction: column;
          height: 100%;
      }
  
  
      .bodyContent {
          background-color: yellow;
          flex: 1;
          overflow-y: scroll;
          height: 100%;
      }
  
      .dialogConAtentBody .bodyContent:empty {
          display: none;
      }
  &lt;/style&gt;
  
  &lt;div class="dialogOverlay" data-bind="visible: isOpen"&gt;
  
      &lt;div class="dialogBase"&gt;
  
          &lt;div class="dialogContentBody"&gt;
  
              &lt;div class="bodyContent" data-bind="compinent: { name: bodyContentComponentName , params: bodyContentComponentParams}"&gt;
                  .
                  .
                  .
                  lots of content
                  .
                  .
                  .
              &lt;/div&gt;
  
          &lt;/div&gt;
  
      &lt;/div&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>This one Does</strong></p>
  
  <pre><code>&lt;style&gt;
      .dialogOverlay {
          z-index: 600;
          position: absolute;
          left: 0;
          top: 0;
          height: 100vh;
          width: 100vw;
          background-color: rgba(0,0,0,0.4);
          display: flex;
          justify-content: center;
          align-items: center;
      }
  
      .dialogBase {
          position: relative;
          min-width: 120px;
          max-width: 75%;
          overflow: hidden;
          height: 500px;
          background-color: white;
          border: 1px solid black;
          margin: 10px;
          z-index: 601;
      }
  
      .dialogContentBody {
          z-index: 602;
          display: flex;
          -ms-flex-direction: column;
          -webkit-flex-direction: column;
          flex-direction: column;
          height: 100%;
      }
  
  
      .bodyContent {
          background-color: yellow;
          flex: 1;
          overflow-y: scroll;
          height: 100%;
      }
  
      .dialogConAtentBody .bodyContent:empty {
          display: none;
      }
  &lt;/style&gt;
  
  &lt;div class="dialogOverlay" data-bind="visible: isOpen"&gt;
  
      &lt;div class="dialogBase"&gt;
  
          &lt;div class="dialogContentBody"&gt;
  
              &lt;div class="bodyContent" data-bind="compinent: { name: bodyContentComponentName , params: bodyContentComponentParams}"&gt;
                  .
                  .
                  .
                  lots of content
                  .
                  .
                  .
              &lt;/div&gt;
  
          &lt;/div&gt;
  
      &lt;/div&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>As per Micheal B's last comment, absolute and relative positioning is also placed on the 2 outer containers.</p>
  
  <h1>Final Update</h1>
  
  <p>So after a couple of hours of head scratching, some furious white board scribbles with my colleague here in the UK, and some fantastic input from Michael_B and LGSon , the solution turned out to be quite descriptively simple.</p>
  
  <p><strong>Repeat your min/max height all the way down the chain</strong></p>
  
  <p>Michael_B was the first one to realize it was an <em>inheritance</em> problem, in so much that there where gaps going back up to the parent where 100% on the height calculation where missing.</p>
  
  <p>However, while this worked, there where some missing links.  LGSon realized that these links where in fact to duplicate the min/max rules down the chain, so that any children also had a height up the chain to work with.</p>
  
  <p>I wish I could mark <strong>BOTH</strong> responses as the answer folks, but alas LGSon's answer was the one that finally got things going, unfortunately, I cant share all the code, but here's what I can share:</p>
  
  <p><strong>The outer dialog</strong></p>
  
  <pre><code>&lt;style&gt;
      .dialogOverlay {
          z-index: 600;
          position: absolute;
          left: 0;
          top: 0;
          height: 100vh;
          width: 100vw;
          background-color: rgba(0,0,0,0.4);
          display: flex;
          justify-content: center;
          align-items: center;
      }
  
      .dialogBase {
          position: relative;
          min-width: 120px;
          min-height: 120px;
          max-width: 75vw;
          max-height: 75vh;
          background-color: white;
          border: 1px solid black;
          margin: 10px;
          z-index: 601;
          overflow: hidden;
      }
  
               .dialogBase .titleBar {
                  background-color: #6e6e6e;
                  color: white;
                  height: 50px;
                  width: 100%;
                  border-bottom: 1px solid black;
                  display: flex;
                  align-items: center;
                  justify-content: center;
              }
  
                  .dialogBase .titleBar .titleContent {
                  padding-left: 10px;
                  font-size: 2.5rem;
                  -ms-flex: 1;
                  -webkit-flex: 1;
                  flex: 1;
              }
  
                  .dialogBase .titleBar .iconContent {
                  width: 50px; /* Square icons, 50x50 */
                  text-align: center;
                  font-size: 2.5rem;
              }
  
                      .dialogBase .titleBar .iconContent.okIcon {
                      color: #449D44;
                      cursor: pointer;
                  }
  
                          .dialogBase .titleBar .iconContent.okIcon:hover {
                          color: #03FF03;
                      }
  
                      .dialogBase .titleBar .iconContent.closeIcon {
                      color: #C9302C;
                      cursor: pointer;
                  }
  
                          .dialogBase .titleBar .iconContent.closeIcon:hover {
                          color: #FF0600;
                      }
  
      .bodyContent {
          overflow-y: hidden;
          min-height: 120px;
          max-height: calc(75vh - 50px);
      }
  
  &lt;/style&gt;
  
  &lt;div class="dialogOverlay" data-bind="visible: isOpen"&gt;
  
      &lt;div class="dialogBase"&gt;
  
          &lt;div class="titleBar"&gt;
              &lt;div class="titleContent" data-bind="text: pageTitle"&gt;&lt;/div&gt;
              &lt;div class="iconContent okIcon"&gt;
                  &lt;i class="fa fa-check-circle" data-bind="click: handleOkButton"&gt;&lt;/i&gt;
              &lt;/div&gt;
              &lt;div class="iconContent closeIcon"&gt;
                  &lt;i class="fa fa-times-circle" data-bind="click: handleCloseButton"&gt;&lt;/i&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  
          &lt;div class="bodyContent" data-bind="component: { name: bodyContentComponentName , params: bodyContentComponentParams}"&gt;ANOTHER COMPONENT IS INJECTED HERE&lt;/div&gt;
  
      &lt;/div&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>The inner dialog markup (INJECTED COMPONENT[s])</strong></p>
  
  <pre><code>&lt;style&gt;
      .dialogInnerContainer {
          display: flex;
          align-items: stretch;
          -ms-align-content: stretch;
          -webkit-align-content: stretch;
          align-content: stretch;
      }
  
          .dialogInnerContainer .tabBar {
              width: 60px;
              background-color: orange;
              border-right: 1px solid black;
          }
  
          .dialogInnerContainer .mainContentArea {
              overflow-y: auto;
              overflow-x: hidden;
              min-height: 120px;
              max-height: calc(75vh - 50px);
          }
  &lt;/style&gt;
  
  &lt;div class="dialogInnerContainer"&gt;
  
      &lt;div class="tabBar"&gt;
          Mini side bar content get's put in here
      &lt;/div&gt;
  
      &lt;div class="mainContentArea"&gt;
          Generated main contnet that needs to scroll gets put in here
      &lt;/div&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>Many thanks to <strong>ALL</strong> who had an input on this.</p>
  
  <p>Shawty</p>