Welcome to WebmasterWorld Guest from 23.22.46.195

Forum Moderators: incrediBILL

div will not centrally align in IE

(works fine in firefox)

   
8:34 pm on Nov 15, 2004 (gmt 0)

10+ Year Member



On my personal website, the layout is dominated by a div tag that fixes the page's width and centrally aligns it, among others. Here's the code for the div:

<div style="border: 1px #fff solid; background: #000; margin: auto; padding: 10px; width: 750px;">

And, as I understand, the 'margin: auto;' attribute is what centrally aligns the whole div. (and it works fine in IE, Firefox, and Opera)

However, I have forums (powered by XMB) installed on my site as well, in an appropriate directory. I also have the div tag placed there in order to keep the site looking relatively the same:

<div style="border: 1px #fff solid; background: #000; margin: auto; padding: 10px; width: 750px;">

BUT - the forums section aligns centrally in Firefox and Opera, but NOT in IE. I can't for the life of me figure out why, and I've tried a plethora of ways to fix it.

Anyone have any insight?

8:43 pm on Nov 15, 2004 (gmt 0)

WebmasterWorld Senior Member suzyuk is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Hi FloppyCopy - Welcome to WebmasterWorld

IE does not support the margin: 0 auto; method of centering it still requires "text-align: center;" but that needs to be on the parent element so

body {text-align: center;}

div {text-align: left; margin: 0 auto; width: 750px;}

should do it.. or whatever your parent element is for that div, note setting the actual text alignment back the default may be required in your div

Suzy

8:50 pm on Nov 15, 2004 (gmt 0)

10+ Year Member



Wow, that was easy enough. Thanks so much.
 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month