vertical aligning table in div

Soldato
Joined
2 Nov 2002
Posts
3,304
Location
Aberdeen
I'm trying to vertically, and horizontally align a table into a div, with the div slightly bigger than the table, thus giving me a border. I know i could always just "padding:5pt" but i don't want that.

I have it aligned horizontally, but i cannot find how to align vertically correctly.

Code:
div.gbg
		{
		background-color: #393939;
		height: 495px;
		width: 790px;
		margin: 0 auto;
		text-align: center;
		margin-top: 50px;
		}

is my code for the div.

I have looked around on the net, but i cannot find anything so far that works cross browser.

Can anyone help me on this topic?
 
From what I remember CSS doesn't support vertical alignment.

If you want a border on your table all you need to do is give your table a class with a border which means the div isn't needed

Code:
<table class="mytable">
<tr>
<td>Content of my table</td>
</tr>
</table>


.mytable
{
border: 1px solid #000;
padding: 5px;
}

Hope thats what you meant
 
IT does allow vertical align, i've done it to my cells etc.

But i've redesigned to a degree. I can't believe i never thought of just giving the table a border in the first place lol. Cheers.
 
Back
Top Bottom