Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Jan 2005
    Posts
    470
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Exclamation Adding DTD to page causes alignment problems in IE

    I just tried adding <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    to a web page that didn't have it before now. Everything renders fine in Firefox but when I view the page in Internet Explorer 6 it centers every piece of content in every table and div tag (basically everything). If I remove the DTD then everything goes back to normal in IE. I have checked and cannot find anything in my CSS or HTML that would tell the browser to center the contents of every element on the page. Just a few isolated align="center" attributes on various tags.

    Any idea what is going on here?

    Sorry I can't post a code example.

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    without any code, you probably wont get an answer that will fix your problem, either show us the code or just keep getting views at this thread and no answers

  • #3
    Regular Coder
    Join Date
    Jan 2005
    Posts
    470
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by _Aerospace_Eng_
    without any code, you probably wont get an answer that will fix your problem, either show us the code or just keep getting views at this thread and no answers
    I was hoping someone had heard of some common problem that might cause this.

    Unfortunately company policy won't allow me to post the output of any code on our testing server.

    If this isn't something that can be readily diagnosed then I am only left with the option of dropping WAI standards compliance until such a point as I can allocate time to pour through the code line-by-line to figure out what is causing Internet Explorer to spit out misaligned elements.

    We are only failing a few validations as it is, though I would like to see a DOCTYPE declaration and LANG tag added to our page output.

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    okay is there any way u can recreate it with the lack of company info, and are you using margin:auto; in the css any where? and the fact that u are using align=center tells me you may need to get update with coding, because that is deprecated and shouldn't be used anymore

  • #5
    Regular Coder
    Join Date
    Jan 2005
    Posts
    470
    Thanks
    3
    Thanked 0 Times in 0 Posts
    I believe I may have fixed the problem. I looked at the source in Firefox and compared that with what is in Internet Explorer. When viewed from IE there was a mysterious <div align="center"> right after the body tag that wasn't in the code when viewed with Firefox. I went back and checked the code generated by the server and there was no div tag at all right after the body tag. I modified the code some more to fix some other issues and then reloaded and now that tag doesn't show in IE and the layout looks like it should.

    I had reloaded the browser page a number of times and other changes had shown up. Maybe it was stuck in the PHP code cache...otherwise I can't figure where that div tag came from or where it went to.

    Thanks for mentioning the align tag depreciation. I really thought that was depreciated only when used with the table tag and not to any other tag. I have since replaced a lot of align tags with style="text-align:whatever".


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •