-
September 3rd, 2007, 11:37 PM
#1
[RESOLVED] Centering a table
I am trying to center a table that I have in a website that I am building. However I need to know how to center the table in the middle of the screen. I already tried the <h2 align="center"> tag. That didn't work. If you could help me that would be greatly appreciated.
thanks,
will
-
September 4th, 2007, 05:17 AM
#2
Enclose your table with the <center></center> tags. For example:
Code:
<html>
<title>Hello World!</title>
<body></body>
Not centered:<br>
<table width="50%" border="10" cellpadding="7" cellspacing="1">
<tr>
<td align="center">
<br>
<font face="verdana", "helvetica", "arial">
Hello World!
</font"
<br>
<br>
</td>
</tr>
</table>
<br>
<br>
Centered:<br>
<center>
<table width="50%" border="10" cellpadding="7" cellspacing="1">
<tr>
<td align="center">
<br>
<font face="verdana", "helvetica", "arial">
Hello World!
</font"
<br>
<br>
</td>
</tr>
</table>
</center>
</html>
-
September 4th, 2007, 01:52 PM
#3
Centering a table
I tried that with my table and that didn't work the way that I wanted it to. Here is the code for the table:
Code:
<table border="1">
<tr>
<td><b>September:</b> Children's' Eye Health & Safety Month - Internet Safety Month - Library Card Sign-Up Month!</td>
</tr>
<tr>
<td>September 2, Labor Day</td>
</tr>
<tr>
<td>September 5, <a href="http://www.potsdam.k12.ny.us/AAK/">AAK</a>,Open House</td>
</tr>
<tr>
<td>September 11, <a href="http://www.potsdam.k12.ny.us/District/BOE/BoardMembers.php">BOE</a>,meeting @ 7pm in the High school library</td>
</tr>
<tr>
<td>September 13, <a href="http://www.potsdam.k12.ny.us/LA/">Lawrence Ave</a>,Open House</td>
</tr>
<tr>
<td>September 19, <a href="http://www.potsdam.k12.ny.us/District/PTA/">PTSA</a>,General Membership meeting in the LGIR @ 7pm.</td>
</tr>
<tr>
<td>September 25, <a href="http://www.potsdam.k12.ny.us/Distric/BOE/BoardMembers.php">BOE</a>, Meeting @ 7pm in the High school library
</tr>
</table>
-
September 4th, 2007, 03:46 PM
#4
As spywaredr stated, it's the perfect way to center with basic html......Right after the "body" tags, type in <CENTER>...put in your table, and after you end your table, put in </CENTER>...Look at the code sp'wr'dr, included, the second part, you'll see what (we) mean.
-
September 4th, 2007, 03:54 PM
#5
Your table, verbatim below......Before your code, "<TABLE BORDER="1">..... place <CENTER">
<table border="1">
<tr>
<td><b>September:</b> Children's' Eye Health & Safety Month - Internet Safety Month - Library Card Sign-Up Month!</td>
</tr>
<tr>
<td>September 2, Labor Day</td>
</tr>
<tr>
<td>September 5, <a href="http://www.potsdam.k12.ny.us/AAK/">AAK</a>,Open House</td>
</tr>
<tr>
<td>September 11, <a href="http://www.potsdam.k12.ny.us/District/BOE/BoardMembers.php">BOE</a>,meeting @ 7pm in the High school library</td>
</tr>
<tr>
<td>September 13, <a href="http://www.potsdam.k12.ny.us/LA/">Lawrence Ave</a>,Open House</td>
</tr>
<tr>
<td>September 19, <a href="http://www.potsdam.k12.ny.us/District/PTA/">PTSA</a>,General Membership meeting in the LGIR @ 7pm.</td>
</tr>
<tr>
<td>September 25, <a href="http://www.potsdam.k12.ny.us/Distric/BOE/BoardMembers.php">BOE</a>, Meeting @ 7pm in the High school library
</tr>
</table> </CENTER>.... is what goes after the table...copy and paste the preceding code into your html editor, without my blurbs, you'll see what happens.
-
September 4th, 2007, 04:10 PM
#6
Change this...
<table border="1">
to this...
<table border="1" align="center">
No other changes needed.
"If you look at the sun without shielding your eyes, you'll go blind.
If you look at the moon without covering your eyes, you'll become a poet."
--Serge Bouchard
-
September 4th, 2007, 04:31 PM
#7
center tags will center anything you put them around. It's the old fashioned way, but it still works. The new way would be to set the tables margin to auto in your css, for firefox and opera. For IE, you'd probably need to put text-align:center on the body element, which would center the table (and any other elements)
There is nothing to fear, but life itself.
-
September 4th, 2007, 10:46 PM
#8
Thanks for the help. I finally got what you guys were saying.
-
September 5th, 2007, 05:06 AM
#9
You're welcome.
Pretty easy once you grasp the concept. <center>
Whatever's written in here between the "center" tags will be centered on the web page.
</center>
Last edited by SpywareDr; September 5th, 2007 at 05:09 AM.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|