Jump to content

**SOLVED** table center


anatak

Recommended Posts

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
[code]
<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>
[/code]
here is the css
[code]
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;
}[/code]

any one knows the solution ?
thanks a lot
anatak
Link to comment
https://forums.phpfreaks.com/topic/23920-solved-table-center/
Share on other sites

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;
}
Link to comment
https://forums.phpfreaks.com/topic/23920-solved-table-center/#findComment-108904
Share on other sites

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.