HTML 4.01 versus XHTML1

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • blompa
    New Member
    • Feb 2008
    • 5

    HTML 4.01 versus XHTML1

    Hey there. I have a problem with some really simple xhtml.
    The following will just pile up the text, and ignore any positioning.

    Code:
    <!DOCTYPE html
            PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
            "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en_EN" xml:lang="en_EN">
    <head>
    <title>UMDB:Unknown?</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta name="generator" content="pdftohtml 0.40" />
    <meta name="author" content="Andreas Blom" />
    <meta name="date" content="2007-11-13T06:12:48+00:00" />
    <style type="text/css">
    <!--
            .ft0{vertical-align:top;font-size:13px;font-family:Times;color:#000000;letter-spacing:0.00000px;}
            .ft1{vertical-align:top;font-size:16px;font-family:Times;color:#000000;letter-spacing:0.00000px;}
    -->
    </style>
    </head>
    <body>
    <div style="position:relative;width:892;height:1263;">
    <div style="position:absolute;top:58;left:779"><span class="ft0">1</span></div>
    <div style="position:absolute;top:111;left:389"><span class="ft1">2007-10-12</span></div>
    
    </div>
    
    </body>
    </html>
    The following code is the exact same, except for the header. It is now html4. Due to other factors html4 is not really an option , (or it is at least as complicated to solve the html4-problem.)

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <HTML>
    <HEAD>
    <title>UMDB:unknown?</title>
    <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <style type="text/css">
    <!--
            .ft0{vertical-align:top;font-size:13px;font-family:Times;color:#000000;letter-spacing:0.00000px;}
            .ft1{vertical-align:top;font-size:16px;font-family:Times;color:#000000;letter-spacing:0.00000px;}
    -->
    </style>
    </head>
    <body>
    <div style="position:relative;width:892;height:1263;">
    <div style="position:absolute;top:58;left:779"><span class="ft0">1</span></div>
    <div style="position:absolute;top:111;left:389"><span class="ft1">2007-10-12</span></div>
    
    </div>
    
    </body>
    </html>
    Now the html4-version renders correctly in all browers.

    BOTH are correct according to http://validator.w3.or g but only html4-version works. according to xhtml1 definitions nothing in the code above is wrong. why why why won't it work ?
  • drhowarddrfine
    Recognized Expert Expert
    • Sep 2006
    • 7434

    #2
    Your doctype does not include the URL so IE goes into quirks mode. The version you use is deprecated. Use this one:

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">

    However, since you were using quirks, this may change what your page looks like.

    Why is HTML4.01 not an option? Are you serving your page as XHTML, or only using the doctype? I'd bet that you are serving your xhtml as html.

    Comment

    • blompa
      New Member
      • Feb 2008
      • 5

      #3
      Hey, I sent you a private message with a few links to compare between.

      Comment

      • blompa
        New Member
        • Feb 2008
        • 5

        #4
        on a sidenote. all browser (opera, firefox and ie7) displays this in the same way.

        Comment

        • blompa
          New Member
          • Feb 2008
          • 5

          #5
          I think I may have solved it.

          the positioning has no unit type.

          apparently this is in accordance with even strict dtd but the browsers don't assume lack of unit type means px should be used.


          hmmmm. div style: might need css verification and not xhtml. xhtml-verification just checks the style-element. not its text string. right?

          Comment

          • drhowarddrfine
            Recognized Expert Expert
            • Sep 2006
            • 7434

            #6
            Units are always required in CSS.
            The (x)html validator only checks (x)html and never CSS.
            Please do not send me PMs. If you have a question about this problem, please post it here so all may learn. This is against forum rules, also.

            Comment

            • blompa
              New Member
              • Feb 2008
              • 5

              #7
              Originally posted by drhowarddrfine
              Units are always required in CSS.
              The (x)html validator only checks (x)html and never CSS.
              Please do not send me PMs. If you have a question about this problem, please post it here so all may learn. This is against forum rules, also.
              Right. no PMs.
              Reason for was that I didn't want to openly share those links.

              Comment

              Working...