Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how do i center an elemend in css and xhtml strict

Status
Not open for further replies.

soniclnd

Technical User
Jan 6, 2005
51
US
i want to center a table in xhtml strict but it won't let me....

the <center> tag is obsolete, and the <div align="center"> is also obsolete... how can i center my table with proper xhtml strict?...
 
no, i disagree with that answer.

Code:
<style type="text/css">
#wrapper {
    text-align: center;
}

#specialtable {
    margin: 0 auto;
}



<div id="wrapper">
<table id="specialtable">
...
</table>
</div>
</style>

*cLFlaVA
----------------------------
[tt]Sigs cause cancer.[/tt]
 
works great, thanks a lot, now it validates!!!
thanx
 
Agre with cflava. The text-align part is really only needef ror IE5x. IE6 and FireFox both handle the margin: auto properly. That is the preferred, and perfectly validated, way to handle it.

Just don't forget to put a text-align: left/right in the child div's so that the text-align: center doesn't inherit.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top