User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2b) Gecko/20021028 Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2b) Gecko/20021028 When a (valid) XHTML document is served as application/xhtml+xml it renders incorrectly. The same document is ok when served as text/html. Examples: http://dantooine.dyndns.org/~ehn/index.xhtml http://dantooine.dyndns.org/~ehn/index.html That's the same document (one is a symlink to the other) served with different content types. Reproducible: Always Steps to Reproduce: 1. Start Mozilla 2. Go to http://dantooine.dyndns.org/~ehn/index.xhtml Actual Results: The layout is broken. Expected Results: Render the valid XHTML document correctly.
Remove <link href="style/general.css" rel="stylesheet" type="text/css" /> and put <?xml-stylesheet href="style/general.css" type="text/css"?> after the doctype declaration.
Eh, never mind (well, yes add it anyway). Your comment delimiters preceding the inline CSS doesn't work well with XML. Delete those delimiters and it will work (Netscape 1.07 won't render application/xhtml+xml anyway, so you won't need them).
Agreed. You can use "comments" in <style> and <script> in HTML because those elements are declared content type CDATA, so no markup is recognized within them except for end-tags. XML doesn't have CDATA content types, so the "<!--" really *is* parsed as a comment and the content disappears. See XHTML 1.0 Appendix C, Section 4. This bug is INVALID.
Ok, I removed the comments around the inlined CSS and changed <link href="style/general.css" rel="stylesheet" type="text/css" />" to <?xml-stylesheet href="style/general.css" type="text/css"?>. Most of the problems disappeared. However, there is still one difference in the way the document renderes when served as application/xhtml+xml as opposed to text/html. With the former content type the background (defined in the general.css) is ignored.
That's because the background is defined on the body element. In XHTML yous should define that stuff on the html element.
Btw, leave <link href="style/general.css" rel="stylesheet" type="text/css" /> if you intend to serve your document also as HTML. HTML renderers don't recognize XML directives and thus need the linked stylesheet. Also, our fave browser IE doesn't recognize XML linked stylesheets and in fact defaults to quirks mode if such a tag is there... if you need IE compatibility, you should remove <?xml-stylesheet href="style/general.css" type="text/css"?>. I am sorry if I have confused you.
Everything works well now. Thanks for clearing things up!
verified per reporter