Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.