Page 1 of 1
Tables in HTML
Posted: Mon Mar 08, 2010 3:45 pm
by Jace-N
I am designing a personal website for a friend. On two pages of the website I am using a table to display information. Everything is working and showing up properly, but the table is not centered on the web page. Can anyone help me figure out how to get it centered?
Re: Tables in HTML
Posted: Mon Mar 08, 2010 3:52 pm
by silent wind
Jace-N wrote:I am designing a personal website for a friend. On two pages of the website I am using a table to display information. Everything is working and showing up properly, but the table is not centered on the web page. Can anyone help me figure out how to get it centered?
Code: Select all
<center>
<table>
<tr>
<td> </td>
</tr>
</table>
</center>
That is how I would do it...
Unless you are using CSS... then you can use the style elements to control that. Everything will be centered though... including your cell content... so if you want that stuff to be aligned differently, I think you have to do something like <table align="left"> which will bump everything in the table over to a left alignment.
hope that helps.
Re: Tables in HTML
Posted: Mon Mar 08, 2010 4:29 pm
by hecter
I'd recommend using CSS. If you don't know it, you should learn it.
http://w3schools.com/
For all your web-based learning needs. It's pretty good. Don't take the tests they offer though, it would be a waste of money. For the time being, just try:
Code: Select all
<table style="width: XX%; margin: 0 auto 0 auto">
...
</table>
That will centre the table without also centring EVERYTHING IN the table.
Re: Tables in HTML
Posted: Mon Mar 08, 2010 5:49 pm
by Jace-N
Ive tried both but neither have worked. I have no idea as to why. I guess I'll just have to keep messing with it.
Re: Tables in HTML
Posted: Mon Mar 08, 2010 5:57 pm
by hecter
Jace-N wrote:Ive tried both but neither have worked. I have no idea as to why. I guess I'll just have to keep messing with it.
Can we see your source code?
Re: Tables in HTML
Posted: Mon Mar 08, 2010 6:37 pm
by Optimus Prime
As hecter said, learning CSS will take you a lot further in building a website than using a table based layout.