anatak Posted October 14, 2006 Share Posted October 14, 2006 Hello,I am trying to center a table with CSS but can not get it to do it.this is the tableIf 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 lotanatak Link to comment https://forums.phpfreaks.com/topic/23920-solved-table-center/ Share on other sites More sharing options...
wildteen88 Posted October 14, 2006 Share Posted October 14, 2006 Use text-align and not alignalign does not exist in CSS. Link to comment https://forums.phpfreaks.com/topic/23920-solved-table-center/#findComment-108747 Share on other sites More sharing options...
anatak Posted October 14, 2006 Author Share Posted October 14, 2006 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 More sharing options...
wildteen88 Posted October 15, 2006 Share Posted October 15, 2006 Try using auto margins:margin: 0 auto;That should center your table. Make sure your table has a width set. Link to comment https://forums.phpfreaks.com/topic/23920-solved-table-center/#findComment-109014 Share on other sites More sharing options...
anatak Posted October 19, 2006 Author Share Posted October 19, 2006 Thanks wildteen88that did the trick. Link to comment https://forums.phpfreaks.com/topic/23920-solved-table-center/#findComment-111152 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.