Jump to content


Photo

**SOLVED** table center


  • Please log in to reply
4 replies to this topic

#1 anatak

anatak
  • Members
  • PipPipPip
  • Advanced Member
  • 406 posts
  • LocationJapan, Fukuoka prefecture, Kitakyushu City

Posted 14 October 2006 - 05:36 AM

Hello,

I am trying to center a table with CSS but can not get it to do it.
this is the table
If I change (line 3)<table border="0" cellpadding="0" cellspacing="0" class="index">
into
<table border="0" cellpadding="0" cellspacing="0" align="center" class="index">
then it centers but I can not get this to work using css
<table border="0" cellpadding="0" cellspacing="0" class="frame"><tr><td class="frame">

<table border="0" cellpadding="0" cellspacing="0" class="index">
	<tr>
	<td class="index_top_left">
top left
	</td>
	<td class="index_top_main" border="0" cellpadding="0" cellspacing="0">
top mid
	</td>
	<td class="index_top_right" border="0" cellpadding="0" cellspacing="0">
top right
	</td>
	</tr>
	<tr>
	<td class="index_left" VALIGN ="top" border="0" cellpadding="0" cellspacing="0">
mid left
	</td>	
	<td class="index_main" VALIGN="top" border="0" cellpadding="0" cellspacing="0">
mid mid	
	</td>
	<td class="index_right" VALIGN="top" border="0" cellpadding="0" cellspacing="0">
mid right
	</td>
	</tr>
	<tr>
	<td class="index" colspan="3" border="0" cellpadding="0" cellspacing="0">
bottom
	</td>
	</tr>
</table>
here is the css
table.frame
{
	width: 100%;
	border: 0px none #EEEEEE;
	border-spacing: 0px;
	background-color: #EEEEEE; /*background-color*/
	padding: 2px;
	align: center;
}

td.frame
{
	color: #000000; /*text color*/
	border: 0px none #EEEEEE; /*border style thickness color*/
	text-align: center;
	vertical-align: middle;
	background-color: #EEEEEE;  /*background-color*/
	font-size: 12pt; /*font-size*/
}


/*index page table opmaak*/
table.index
{
	width: 800px;
	border: 0px none #AAAAFF;
	border-spacing: 0px;
	padding: 0px; 
	background-color: #EEEEEE;
	align: center;
}

any one knows the solution ?
thanks a lot
anatak
takasi.8008@docomo.ne.jp
tourokum@0508.jp

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 14 October 2006 - 10:00 AM

Use text-align and not align

align does not exist in CSS.

#3 anatak

anatak
  • Members
  • PipPipPip
  • Advanced Member
  • 406 posts
  • LocationJapan, Fukuoka prefecture, Kitakyushu City

Posted 14 October 2006 - 11:29 PM

I tried to use text-align and that does not work.
Is there anything wrong with this CSS part ?

table.frame
{
width: 100%;
border: 0px none #EEEEEE;
border-spacing: 0px;
background-color: #EEEEEE; /*background-color*/
padding: 2px;
text-align: center;
}

takasi.8008@docomo.ne.jp
tourokum@0508.jp

#4 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 15 October 2006 - 10:44 AM

Try using auto margins:
margin: 0 auto;

That should center your table. Make sure your table has a width set.

#5 anatak

anatak
  • Members
  • PipPipPip
  • Advanced Member
  • 406 posts
  • LocationJapan, Fukuoka prefecture, Kitakyushu City

Posted 19 October 2006 - 11:03 AM

Thanks wildteen88
that did the trick.



takasi.8008@docomo.ne.jp
tourokum@0508.jp




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users