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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

centered in mozilla, not in IE 6 2

Status
Not open for further replies.

mldmld

Technical User
Jul 22, 2003
95
US
If you go to the page is centered how I want it in Mozilla, but if you open with IE6 it is to the left. Thanks for the help
 
From your page below, you have the table with the Star Card graphic in it aligned left. Did you look at the HTML to see what it was doing?

Code:
<div style="text-align: center;"></div>
<table style="[red][b]text-align: left;[/b][/red] margin-left: auto; margin-right: auto;" border="0" width="600">
  <tbody>
    <tr>
      <td width="82"><img src="StarCard.gif" height="139" width="82"></td>
      <td width="468">
      <div align="center"><font color="#ffffff"
 face="Georgia, Times New Roman, Times, serif" size="+2"><strong>Psychic
April has 15 years experience in Psychic, Palm, and Tarot Readings</strong></font></div>
      </td>
      <td width="36"><img src="Queen%20Card.gif" height="134" width="80"></td>
    </tr>
  </tbody>
</table>

Lee
 
I don't see any changes to affect the placement of the table you originally mentioned. If you want to develop web pages, you either have to learn HTML or learn how to use the programs that will write the code for you. Those programs, AT BEST, only work as well as you know how to design, though.

You asked what I thought you should change. I'd rewrite the whole page from scratch, but that's because I only put in the page what I want to be there and where I want it to be.

Lee
 
troll, do you know why the page looks different in IE6 and Mozilla?
 
OK, you've got a series of paired <div>s and <table>s like this:
Code:
<div style="text-align: center;"></div>
<table style="text-align: left; margin-left: auto; margin-right: auto;" border="0" width="600">
   ... contents here ...
</table>
The [tt]margin-left: auto; margin-right: auto;[/tt] is what centres the tale in Mozilla, and it's the way you're supposed to do it.

Unfortunately, IE doesn't understand [tt]margin: auto[/tt], so you have to explore one of its rendering bugs. If you put the table in an area where the text is centre-aligned the table will be too. It looks like somebody has already tried to do that with the <div>, but the table needs to be inside the <div>, not next to it. Change your code to the following and it should work:
Code:
<div style="text-align: center;">
<table style="text-align: left; margin-left: auto; margin-right: auto;" border="0" width="600">
   ... contents here ...
</table>
[red]</div>[/red]

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
Unfortunately, IE doesn't understand margin: auto, so you have to explore one of its rendering bugs. If you put the table in an area where the text is centre-aligned the table will be too. It looks like somebody has already tried to do that with the <div>, but the table needs to be inside the <div>, not next to it. Change your code to the following and it should work:
The above is NOT true with MSIE6. It understands "margin:auto" fine as long as you use a valid <!DOCTYPE>.

I would code it as:
Code:
<div style="text-align: center; margin-left: auto; margin-right: auto;">
<table style="text-align: left;" border="0" width="600">
   ... contents here ...
</table>
</div>

Actually, I would re-write it and get rid of the table and just use CSS.

Ken
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top