title: Absolute positioning according to an indirect parent instead of direct parent
body: <p>I am just working on a simple example to try to understand the behavior of absolute positioning elements. There is a case that I don't understand. </p>
  
  <p>I have a container, with a card inside of it. I want to add a footer inside of this card, so I put another div inside of it, as follow : </p>
  
  <pre><code>&lt;body&gt;
     &lt;section id="experiences"&gt;
        &lt;div class="experiences-cards-container"&gt;
           &lt;div class="experience-card"&gt;
              &lt;div class="card-footer"&gt;&lt;/div&gt;
           &lt;/div&gt;
        &lt;/div&gt;
     &lt;/section&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>As it is a footer, I want it to be displayed at the bottom of my card. That is the reason why I used absolute positioning to do so : </p>
  
  <pre><code>.experience-card .card-footer {
    position: absolute;
    left: 0px;
    bottom: 0px;
    height: 70px;
    width: 100%;
    background-color: blue;
  }
  </code></pre>
  
  <p>But it seems that the footer element does not get positioned according to its direct parent <code>experience-card</code> but to an indirect parent <code>experiences-card-container</code>, because I get the following result : </p>
  
  <p><a href="https://i.stack.imgur.com/HuFLp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HuFLp.png" alt="enter image description here"></a></p>
  
  <p>My question is : Why is the footer element positioned according to an indirect parent and not the card since it is a direct parent ?</p>
  
  <p>Here is the full CSS : </p>
  
  <pre><code>html, body 
  {
      height: 100%;
  }
  
  #experiences {
      height: 100%;
      background-color: #ECECEC;
  }
  
  .experiences-cards-container {
      position: relative;
      width: 100%;
      max-width: 1200px;
      height: calc(100% - 100px);
      text-align: center;
      margin: auto;
  }
  
  .experience-card {
      position: "relative";
      display: inline-block;
      width: 280px;
      height: 350px;
      background-color: white;
      margin-right: 20px;
      box-shadow: 0px 0px 6px 0px #949494;
      margin-bottom: 20px;
      text-align: left;
  }
  
  .experience-card .card-body {
      padding-left: 10px;
      padding-right: 10px;
  }
  
  .experience-card .card-footer {
      position: absolute;
      left: 0px;
      bottom: 0px;
      height: 70px;
      width: 100%;
      background-color: blue;
  }
  </code></pre>