CSS: Position absolute ::before of child with respect to relative grandparent : <p>I'm trying to position an absolutely position <code>::before</code> of an element with respect to its relatively positioned grandparent. It's parent is not positioned, but it's <code>top</code> and <code>left</code> respect the parent and not the grandparent.</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>* {
  box-sizing: border-box;
}

::-webkit-input-placeholder,
::-moz-placeholder {
  color: #9b9b9b;
}

.field {
  height: 43px;
  display: flex;
  flex-direction: column-reverse;
  position: relative;
}
input,
label {
  display: block;
}
input {
  font-size: 14px;
  border: 0;
  border-bottom: 1px solid #F2F2F2;
  border-radius: 0;
  padding: 3px 0 10px 0;
  background-color: transparent;
}
input:focus {
  outline: 0;
  border-bottom: 1px solid #D66C9C;
}
label {
  font-size: 12px;
  color: #9b9b9b;
  transform: translateY(20px);
  transition: all 0.2s;
}
input:focus + label {
  color: #808080;
  transform: translateY(0);
}
input:focus + label::before {
  content: "";
  width: 5px;
  height: 5px;
  display: block;
  background-color: #d66c9c;
  transform: rotate(45deg) translateY(-50%);
  position: absolute;
  left: 0;
  bottom: 0;
}</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;meta name="viewport" content="width=device-width"&gt;
  &lt;title&gt;JS Bin&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div class="field"&gt;
  &lt;input type="text" id="fullname"&gt;
  &lt;label for="fullname"&gt;Name&lt;/label&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</code></pre>
</div>
</div>
</p>
