Centering a table vertically in a Div
<p>I did some research and found that the only way to vertically center a table inside a div(where the table does not span the full height, the height varies with varying content) is with javascript/jquery:</p>

<pre><code>&lt;script&gt;
   var tableMarginTop = Math.round( (testHeight - tableHeight) / 2 );
   $('table').css('margin-top', tableMarginTop)
&lt;/script&gt;
</code></pre>

<p>Now my code looks like this: 
CSS:</p>

<pre><code>.rightDiv{
    width: 300px
    height: 380px;
    background: url(http://myimage.com) no-repeat;
}

.rightDiv table{
    margin: auto; /*For centering horizontally*/
}
</code></pre>

<p>HTML:</p>

<pre><code>&lt;div class="rightDiv"&gt;
  &lt;table width="80%"&gt;
    &lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
  &lt;/table&gt;
&lt;/div&gt;
</code></pre>

<p>My question: How to I implement that code for this situation? Not sure how to call the specific div class and table class in the JS function for the relevant div and table?</p>

<p>Thank You</p>
