By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,446 Members | 1,185 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,446 IT Pros & Developers. It's quick & easy.

HTML 4.01 versus XHTML1

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

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html
  2.         PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  3.         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4. <html xmlns="http://www.w3.org/1999/xhtml" lang="en_EN" xml:lang="en_EN">
  5. <head>
  6. <title>UMDB:Unknown?</title>
  7. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  8. <meta name="generator" content="pdftohtml 0.40" />
  9. <meta name="author" content="Andreas Blom" />
  10. <meta name="date" content="2007-11-13T06:12:48+00:00" />
  11. <style type="text/css">
  12. <!--
  13.         .ft0{vertical-align:top;font-size:13px;font-family:Times;color:#000000;letter-spacing:0.00000px;}
  14.         .ft1{vertical-align:top;font-size:16px;font-family:Times;color:#000000;letter-spacing:0.00000px;}
  15. -->
  16. </style>
  17. </head>
  18. <body>
  19. <div style="position:relative;width:892;height:1263;">
  20. <div style="position:absolute;top:58;left:779"><span class="ft0">1</span></div>
  21. <div style="position:absolute;top:111;left:389"><span class="ft1">2007-10-12</span></div>
  22.  
  23. </div>
  24.  
  25. </body>
  26. </html>
  27.  
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.)

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <HTML>
  3. <HEAD>
  4. <title>UMDB:unknown?</title>
  5. <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
  6. <style type="text/css">
  7. <!--
  8.         .ft0{vertical-align:top;font-size:13px;font-family:Times;color:#000000;letter-spacing:0.00000px;}
  9.         .ft1{vertical-align:top;font-size:16px;font-family:Times;color:#000000;letter-spacing:0.00000px;}
  10. -->
  11. </style>
  12. </head>
  13. <body>
  14. <div style="position:relative;width:892;height:1263;">
  15. <div style="position:absolute;top:58;left:779"><span class="ft0">1</span></div>
  16. <div style="position:absolute;top:111;left:389"><span class="ft1">2007-10-12</span></div>
  17.  
  18. </div>
  19.  
  20. </body>
  21. </html>
  22.  
Now the html4-version renders correctly in all browers.

BOTH are correct according to http://validator.w3.org but only html4-version works. according to xhtml1 definitions nothing in the code above is wrong. why why why won't it work ?
Feb 26 '08 #1
Share this Question
Share on Google+
6 Replies


drhowarddrfine
Expert 5K+
P: 7,435
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.
Feb 27 '08 #2

P: 5
Hey, I sent you a private message with a few links to compare between.
Feb 27 '08 #3

P: 5
on a sidenote. all browser (opera, firefox and ie7) displays this in the same way.
Feb 27 '08 #4

P: 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?
Feb 27 '08 #5

drhowarddrfine
Expert 5K+
P: 7,435
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.
Feb 27 '08 #6

P: 5
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.
Feb 28 '08 #7

Post your reply

Sign in to post your reply or Sign up for a free account.