SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: DOCTYPE in IE7

Hybrid View

  1. #1
    Knowledge is key 2 progression Tryst's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    DOCTYPE in IE7

    Hi all,

    I am using asp.net 1.1 which outputs the following at the top of its ASPX pages...


    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
    <html>
    ...


    but I have since added the following...


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">


    and since doing this and then refreshing the browser I noticed that the elements repositioned slightly. Is this related to the box model issue? I thought that this was all fixed in IE7.

    Or does the fact that I included a namespace in <html> tag do something?

    Just confused as to what the main differences are between the two posted above.

    Thanks in advance.

  2. #2
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,478
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'd need to see a link to the page in question. In the meantime, do you have one or both DOCTYPE declarations in your page? (I'm presuming the former.)

  3. #3
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Tryst View Post
    and since doing this and then refreshing the browser I noticed that the elements repositioned slightly. Is this related to the box model issue? I thought that this was all fixed in IE7.
    The first doctype will put IE7 in quirks mode, since it doesn't contain a system identifier. In quirks mode IE7 uses the broken box model.

    The second one will put IE7 in 'standards' mode, where it will use the correct box model.

    Quote Originally Posted by Tryst View Post
    Or does the fact that I included a namespace in <html> tag do something?
    No, IE7 doesn't support XHTML. If you see anything at all (rather than being asked to download the page) you're serving your document as text/html, which means it's interpreted as invalid HTML instead of XHTML. The xmlns attribute is invalid in HTML, so browsers will just ignore it.

    Quote Originally Posted by Tryst View Post
    Just confused as to what the main differences are between the two posted above.
    Aside from the quirks/standards mode issues, there's a world of difference. The first one says you're using HTML 4.0 Transitional, the second says XHTML 1.0 Strict. See the XHTML vs HTML FAQ for details.

    If you're going to use an XHTML doctype, you must make sure ASP.NET outputs well-formed XML markup. Even if you serve it as HTML, it must still work when served as XHTML.
    Birnam wood is come to Dunsinane

  4. #4
    Knowledge is key 2 progression Tryst's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the replies guys.

    I think I will go with the first one then

    I thought QUICKS MODE was completely removed in IE7.

  5. #5
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, quirks mode needs to remain in order not to make millions of old-school websites inaccessible.

    The doctype declaration I'd recommend that you use is this one,
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    HTML 4.01 Strict is the latest and greatest DTD with any browser support worth mentioning.
    Birnam wood is come to Dunsinane

  6. #6
    Knowledge is key 2 progression Tryst's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, thanks, AutisticCuckoo.


Bookmarks

Posting Permissions

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