PrimeSuspect Posted October 22, 2010 Posted October 22, 2010 Hello Everything is oke for firefox but not for ie.Writings show up on left of the table.But i want it to shows up on center of the table like in firefox. Code : <div class="redbg"> <div class="red_txt1">Players:<span> $membs</span>Online Now: <span> $online</span></div> <table width='180' border='0' cellspacing='0' cellpadding='0'> <tr> <style type='text/css'> .style1 { text-align: center; } </style> <div class='style1'> <h3><u>$gameinfo</u></h3> $players $membs $mal $male $fems $fem</div> </td></tr> </table> Quote
a_bertrand Posted October 22, 2010 Posted October 22, 2010 <CENTER><TABLE WIDTH=180></TABLE> or <TABLE ALIGN=CENTER WIDTH=180></TABLE> Quote
PrimeSuspect Posted October 22, 2010 Author Posted October 22, 2010 thnx but it didnt work..May it be about css ? Quote
bluegman991 Posted October 22, 2010 Posted October 22, 2010 this is the solution to all browser to center a table <table style="margin-left:auto; margin-right:auto;"></table> Quote
Djkanna Posted October 23, 2010 Posted October 23, 2010 Bluegman991: No need to define both margin left and right, below is so much simpler. <table style="margin: 0 auto;"></table> Quote
a_bertrand Posted October 23, 2010 Posted October 23, 2010 PrimeSuspect: if my solution didn't worked it may be due tone of: 1) You are within a container which doesn't take the whole width 2) You use XHTML Quote
Spudinski Posted October 23, 2010 Posted October 23, 2010 a_bert is right, IE messes around with certain things. Try defining an absolute width for the table. Also, you might want to look further on, it might be that IE is using a previous defined alignment. Oh and PS., margin has nothing to do text alignment. It's a positioning instruction for elements. Quote
Djkanna Posted October 23, 2010 Posted October 23, 2010 Oh and PS., margin has nothing to do text alignment. It's a positioning instruction for elements. I didn't read I just saw Bluegmans reply xD Quote
bluegman991 Posted October 23, 2010 Posted October 23, 2010 o i did'nt see the text part ur html was very dirty so im gonna redo it and see if that helps a problem i first seen is that u had a style tag after a <TR> tag in the middle of a table so if this doesnt work u should look through all of ur html and make sure <style>,<link>,<title>,<meta>,<script>,etc... tags are in the <head> tag and not in the middle of any other tag also when using <table> tags and u write text to the table without putting <th> or <td> tags it will be outside of the table put this somewhere in ur head tag <style type='text/css'> .style1 { text-align: center; } </style> put this where ever u got the peace of code from <div class="redbg"> <div class="red_txt1">Players:<span>$membs</span>Online Now: <span> $online</span></div> <table width='180' border='0' cellspacing='0' cellpadding='0'> <tr><td> <div class='style1'> <h3><u>$gameinfo</u></h3> $players $membs $mal $male $fems $fem</div> </td></tr> </table> Quote
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.