max-height ignored in child elements on Android 4.2
<p>On Android 4.2.2's built-in browser, I defined a <code>height</code> on an element that's greater than its <code>max-height</code>. So it uses the <code>max-height</code>, as expected.</p>

<p>But there's a child element with 100% <code>height</code>, and it seems to inherit its parents <code>height</code> but not the <code>max-height</code>. As a result, it spills out of the parent, when it's intended to be contained within it.</p>

<p>I can sort of fix this by copying the <code>max-height</code> setting to the child, but the parent's borders/padding still prevent the child from being completely contained within the parent.</p>

<p>Is there a good reason/fix for this? It doesn't seem to happen on other browsers, like Chrome.</p>

<p><a href="https://i.stack.imgur.com/pwNnL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pwNnL.png" alt="Example"></a></p>

<pre><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;style&gt;
      .a {
        position: absolute;
        top: 100px;
        left: 100px;
        width: 200px;
        max-height: 50%;
        height: 500px;
        border: 20px solid red;
        box-sizing: border-box;
      }
      .b {
        position: relative;
        width: 100%;
        height: 100%;
        border: 20px solid yellow;
        box-sizing: border-box;
      }
    &lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;div class="a"&gt;
      &lt;div class="b"&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/body&gt;
&lt;/html&gt;
</code></pre>