title: Centering elements vertically within a block
body: <p>I'm currently redesigning my website from a table layout to CSS.  I'm having some problems with what seemed like a very simple task.</p>
  
  <p>The site is simple.  A box in the middle of the screen that contains several links.</p>
  
  <p>The old site used <code>&lt;td valign="center"&gt;</code> to center all the links in the box.  CSS seems to have no equivalent.  I've been centering elements using negative margins like so:  </p>
  
  <pre><code>div {
      height: 200px;
      position: absolute;
      top: 50%;
      margin-top: -100px;
  }
  </code></pre>
  
  <p>This works fine when you know exactly how big the element you're centering is, but I need to be able to center the links without knowing how much vertical size the links take up.  I just want the aligning in the box to act like <code>text-align: center</code>.  Only vertically too.</p>
  
  <p><a href="http://www.nickober.net" rel="noreferrer">Current website designed with tables</a><br>
  <a href="http://www.nickober.net/so/css_layout.html" rel="noreferrer">Current progress on the CSS version</a></p>