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:
<script>
var tableMarginTop = Math.round( (testHeight - tableHeight) / 2 );
$('table').css('margin-top', tableMarginTop)
</script>
Now my code looks like this: CSS:
.rightDiv{
width: 300px
height: 380px;
background: url(http://myimage.com) no-repeat;
}
.rightDiv table{
margin: auto; /*For centering horizontally*/
}
HTML:
<div class="rightDiv">
<table width="80%">
<tr><td></td></tr>
</table>
</div>
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?
Thank You