title: Positioning in mPDF
body: <p>I am working on a business card application, where at the final stage you can generate a PDF file from HTML and CSS. What I am trying to achieve is to absolute position the elements on the image within a <em>div</em>, which has relative positioning. All of my elements are draggable on the card. </p>
  
  <p>Here is my PHP file: (note: I shortened the file to be understandable)</p>
  
  <pre><code>&lt;?php
  
  $html = '&lt;div class="card"&gt;
          &lt;span id="company_card" class="draggable_data"&gt;BMW&lt;/span&gt;
          &lt;img class="bck_icon" src="redtop.jpg" alt="red"&gt;
          &lt;/div&gt;';
  
  include('mpdf/mpdf.php');
  
  $mpdf = new mPDF();
  
  $stylesheet = file_get_contents('test.css'); // external css
  $mpdf-&gt;WriteHTML($stylesheet,1);
  $mpdf-&gt;WriteHTML($html, 2);
  $mpdf-&gt;Output();
  </code></pre>
  
  <p>The CSS file is the following: </p>
  
  <pre><code>.bck_icon {
      border: 1px solid black;
  }
  
  .card {
      margin: auto;
      width: 460px;
      height: 260px;
      position:relative;
  }
  
  #name_card {
      position: absolute;
      top: 190px;
      left:80px;
  }
  </code></pre>
  
  <p>Is there a way to achieve this? I know there are positioning issues in mPDF, but when I do not use the <strong>div</strong> element, then the elements inside the div will not fit the outside relative element.</p>
  
  <p>Any suggestions?</p>