Re: centering a div block

Posted 08 June 2006 - 05:47 AM

Ok so I'm starting to get really pissed off at IE.
I look at this in FF and it's all nice and looks great and yay <Happy_Matt>
But then I look at it in IE and it still F*in' not centered and gRawR! </Happy_Matt>
I added some pics of it so you can see what it is doing...

Re: centering a div block

Posted 08 June 2006 - 06:26 AM

Haven't chacked the code, so this whole thing might be bs...
As Skyhawk said, margin: 0 auto should work. However I think it only works in FF. If I remember correctly, it's an IE bug, and a quick and dirty hack is to set the text-aligment attribute of the containing element, and it will affect all elements, not just text in it. Naturally you'll have to set the text-alignment in your element again, to overwrite the effect of inheritance.

Re: centering a div block

Haven't chacked the code, so this whole thing might be bs...
As Skyhawk said, margin: 0 auto should work. However I think it only works in FF.

Incorrect. It will work in Internet Explorer 6 so long as it's not displaying in quirks mode. That is, so long as you have a document type declaration (DTD) that makes IE display the page in that browser's version of standards mode. Also note that if you use an XHTML DTD, using the XML prolog before a DTD that would normally put IE in standards mode will put it into quirks mode instead (Internet Explorer doesn't understand true XHTML).

Quote

It works now, but changing the DTD isn't going to cause me problems later will it?

It shouldn't cause you any problems unless you want to validate and also use code prohibited under the XHTML Strict DTD (such as the target attribute and iframe element). It'll make your page display in standards mode in Internet Explorer and the standards browsers which will make it easier to code cross-browser compatible pages.

Re: centering a div block

Posted 09 June 2006 - 12:22 PM

Arbitrator, on 9 Jun, 2006 - 12:25 PM, said:

Incorrect. It will work in Internet Explorer 6 so long as it's not displaying in quirks mode. That is, so long as you have a document type declaration (DTD) that makes IE display the page in that browser's version of standards mode. Also note that if you use an XHTML DTD, using the XML prolog before a DTD that would normally put IE in standards mode will put it into quirks mode instead (Internet Explorer doesn't understand true XHTML).

Well, looks-like my disclaimer was in place Maybe it was in IE5, maybe only in my dreams...