title: Angular. Make child 100% width of flex parent
body: <p>I have an Angular component with a main flex div <code>main-container</code> and a child <code>box</code>. I want the child to be in the center of the parent and also to have 100% of parent's width. The snippet of code below, shows that my code is working, but in Angular, the width of <code>box</code> is 80px (made by the padding).</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.main-container {
      width: 100%;
      min-height: 100vh;
      padding: 15px;
      background: linear-gradient(-135deg, #c850c0, #4158d0);
      display: flex;
      justify-content: center;
      align-items: center;
  }
  .box {
      max-width: 500px;
      width: 100%;
      padding: 40px;
      border-radius: 10px;
      background: #fff;
      text-align: center;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="main-container"&gt;
    &lt;div class="box"&gt;
    &lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Here is a photo of how my Angular page looks like:</p>
  
  <p><a href="https://i.stack.imgur.com/vnj8Z.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vnj8Z.png" alt="Angular page with problem"></a></p>
  
  <p>Thank you very much!</p>