Jump to content

Centering a table.


sepoto

Recommended Posts

For some reason my table is offset too far to the left. It is not on center, nor is it left or right justified. This is very perplexing to because as you will see I have done everything I know how to do to make sure all the right things have been done to center everything properly. Attached is the code:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-loose.dtd"><html><head><title>The home page of SepsServer.</title><style>	body {	width: 80%;	margin-left: auto;	margin-right: auto;	}</style><meta http-equiv="content-type" content="text/html;charset=utf-8"><link rel="stylesheet" type="text/css" href="css/superfish.css" media="screen"><script type="text/javascript" src="js/jquery-1.2.6.min.js"></script><script type="text/javascript" src="js/hoverIntent.js"></script><script type="text/javascript" src="js/superfish.js"></script><script type="text/javascript">		// initialise plugins		jQuery(function(){			$("ul.sf-menu").superfish({ dropShadows:  true, delay: 5000});		});</script></head><body><table align="center" width="400" border="0" style='table-layout:fixed'><tr align="center"><td align="center"><?php include_once("superfish.php"); ?></td></tr></table><br><br><div align="center"><table align="center" width="800px" style='table-layout: fixed'><tr><td width="80px"><img src="/img/leftbar.png"></td><td><span style="color: green; font-size: 14pt;"><p>Welcome! You have reached Eric's home page. I am a programmer based in Thousand Oaks CA. I have built this page as a means to display my works to the general public. This page is currently under construction. On this site you will find samples of code that I have written in languages like C++, PHP, C#, JavaScript and more. I also am very proficient with vector based platforms such as AutoCAD and BricsCAD (Linux). Have a look around and enjoy. Just a note, but I also have a wordpress that you can view here: <br><br><div align="center"><a href="http://www.sepsserver.com/wordpress/">The WordPress blog from www.sepsserver.com.</a></div><br><br>Thanks for stopping by!</p></span><br><br><br><div align="center"><a style="font-size: 8pt" href="http://bluefish.openoffice.nl/">Made with Bluefish HTML editor.</a><img src="/img/bluefish.gif" width="7%" height="7%"></div></td></td><td><img src="/img/rightbar.png"></td></tr></table></div><br><br><br></body></html>

Link to comment
Share on other sites

The tables are centred? if you are talking the green text not being centred its because you have not defined the width of this cell, or the next. The left column is width 80px, the other two are equal width for the remaining space available.You can either, define the width of these two cells, or just the cell on right, then the centre cell will expand to the remaining width available.

Link to comment
Share on other sites

For some reason my table is offset too far to the left. It is not on center, nor is it left or right justified....<table align="center" width="800px" style='table-layout: fixed'><tr><td width="80px"><img src="/img/leftbar.png"></td><td>...the center stuff</td></td>........oooooops td closed twice<td><img src="/img/rightbar.png"></td></tr></table>
So here is what I seeone extra TD closed tag. Did not affect rendering on Chrome but might in other browsers.the table is 800pxcolumn 1 is 80px which leaves 720 for everybody elseneither center or right column have a width defined so each takes what it thinks is reasonable.If you define a width for the center column, the text will still occupy the full width of the column and center becomes meaningless. Or are you saying the table is not centered across the page? It is on mine....confused as to the real issue............Guy
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...