Tables in HTML
Moderator: Community Team
Forum rules
Please read the Community Guidelines before posting.
Please read the Community Guidelines before posting.
Tables in HTML
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?
-
silent wind
- Posts: 5
- Joined: Sat Jan 23, 2010 8:24 pm
Re: Tables in HTML
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>
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.
- hecter
- Posts: 14632
- Joined: Tue Jan 09, 2007 6:27 pm
- Gender: Female
- Location: Tying somebody up on the third floor
- Contact:
Re: Tables in HTML
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:
That will centre the table without also centring EVERYTHING IN the table.
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>
In heaven... Everything is fine, in heaven... Everything is fine, in heaven... Everything is fine... You got your things, and I've got mine.


Re: Tables in HTML
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.
- hecter
- Posts: 14632
- Joined: Tue Jan 09, 2007 6:27 pm
- Gender: Female
- Location: Tying somebody up on the third floor
- Contact:
Re: Tables in HTML
Can we see your source code?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.
In heaven... Everything is fine, in heaven... Everything is fine, in heaven... Everything is fine... You got your things, and I've got mine.


- Optimus Prime
- Posts: 9665
- Joined: Mon Mar 12, 2007 9:33 pm
- Gender: Male
Re: Tables in HTML
As hecter said, learning CSS will take you a lot further in building a website than using a table based layout.