• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 351
  • Last Modified:

table center with css

Need to align a table in the center, and put some css elements inside. I'm using the align, and  in internet explorer works fine, but in firefox and chrome align to the left.
0
rflorencio
Asked:
rflorencio
  • 4
  • 3
  • 2
  • +1
3 Solutions
 
Shinesh PremrajanTechnical ManagerCommented:

<table align="center" style="float:center;"  >

Hope this helps..
0
 
rflorencioAuthor Commented:
Expression web says: the property is invalid because is not supported by current schema
0
 
LZ1Commented:
Just use
<table align="center">
The  style="float:center;"  is invalid and not supported by CSS
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
LZ1Commented:
BTW, if the above does not help, please post your code or a live link.
0
 
Shinesh PremrajanTechnical ManagerCommented:
add this CSS style

<style>
#tablecenter{
  float:center;
}
</style>

and then update the table with the id

<table align="center" id="tablecenter" >

Hope this helps
0
 
LZ1Commented:
@shinuq:  There is no attribute float:center.
The proper attributes of float are:
  • left
  • right
  • none
  • inherit
http://www.w3schools.com/css/pr_class_float.asp
0
 
Shinesh PremrajanTechnical ManagerCommented:
oh my apologies.. please ignore the comments ...

Tyr this out..

<center>
<table align="center">
.......
</table>
</center>
0
 
LZ1Commented:
@shinuq:
Please try not to use the <center> tag as it is depreciated and not supported by browsers, like IE
0
 
level9wizardCommented:
If you're using this table for layout, that's a bad idea - you 'd likely be better off using a <div> and applying your styles to that. Tables are meant for tabular data, not styling a page.

In any case, if this is a fixed width table or div (i.e. a width defined), you should be able to do margin: 0 auto;

Also, are you able to share the source code with us?
0
 
rflorencioAuthor Commented:
I put the table inside a div, i have applied align=center in div. Appears to have resulted
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 4
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now