title: How do I prevent the child element from escaping from its parent, if translate or matrix values are applied?
body: <p>For, instance I have an element which have same width and height properties as its parent. I want the parent to contain the child element even if the translate or transform values are applied.</p>
  
  <p>When, I apply x and y properties to the translate or transform the child moves away from its parent. I have tried position values but that doesn't seem to work.</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>.parent {
    width: 50px;
    height: 50px;
    background: #ddd;  
  }
  
  .child {
    width: 50px;
    height: 50px;
    background: red;
    transform: translate(40px, 40px);
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="parent"&gt;
  &lt;div class="child"&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;p&gt;how do I restrict the red one within it's parent?&lt;/p&gt;</code></pre>
  </div>
  </div>
  </p>