title: CSS: Vertical centering in a position:absolute div
body: <p>I have this code:</p>
  
  <pre><code>&lt;div class="parent"&gt;
      &lt;div class="child"&gt;something&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>The parent should be 200px width and height, and the child 100px width and height. The parent is also set to <code>position:absolute</code>. Is it possible to horizontaly and verticaly center the <code>child</code> relative to the <code>parent</code> and how?</p>
  
  <p>The result: If you set black background to the parent and white to the child, the whole thing should look like there is a white square with a large black border.</p>
  
  <p>Static margins and paddings are out of the question since the size of the child will change dynamically.</p>
  
  <hr>
  
  <p>That might not be the proper solution, but what I am actually trying to achieve is a black square which I can change the size of with jQuery and it will stay at the same absolute position, like it is being scaled from the center, not from the top left corner.</p>
  
  <p>I thought I could set the position of a parent and let the child center horizontaly and verticaly auto while changing it's size, so I would get the proper 'scale'-like effect.</p>