D.Slatk Posted February 9, 2005 Share Posted February 9, 2005 Okay...I decided to try and go for xhtml strict, and now I need to know how to center tables with CSS. I can center content (text) but not the physical tables. Stupid strict filtering stuff and it not allowing you to use the align="center" attribute. And I refuse to use <center>. For whatever means. I don't like that tag. You can see my attempt at at trying to align this calendar here: http://biology.talonz.com/examplecalendar.php The code I used was, put simply, like this: >Inside the page: <div class="center"><table><tr><td>Content</td></tr></table></divide> The css for center: .center {text-align: center;} Quote Link to comment Share on other sites More sharing options...
btrfld Posted February 9, 2005 Share Posted February 9, 2005 Hi Daniel. In addition to the DIV centering its text, you need to apply a little css to the TABLE itself. Try this: <div class="center"> <table id="centered"> <tr><td></td></tr> </table> </div> .center { text-align: center; } #centered { margin: 0 auto; } Very brave of you to go straight for XHTML Strict. Good for you, and good luck. Quote Link to comment Share on other sites More sharing options...
borfast Posted February 9, 2005 Share Posted February 9, 2005 Daniel, try this: ><table class="center"><tr><td>Content</td></tr></table> .center { width: 700px; margin-left: auto; margin-right: auto; } No need to use <div> And of course, you can change the 700px to whatever you want the table's width to be Quote Link to comment Share on other sites More sharing options...
D.Slatk Posted February 10, 2005 Author Share Posted February 10, 2005 Ah, thank you both very much. Also, is there any substitute for making a page open in a new window with the target="_blank" (or target="new", or someting, I don't remember what the other way to do it is since I only use the first way)? If not, I'll use javascript, but there must be some way around this... Quote Link to comment Share on other sites More sharing options...
LisaJill Posted February 10, 2005 Share Posted February 10, 2005 No, there's no substitute. Target was deprecated (and for good reasons *winks*) You'll have to use javascript if you insist. =) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.