Forum Moderators: open
It works fine in FireFox, any suggestions?
Doctype is as follows:
<?xml version="1.0" encoding="iso-8859-1"?>
<!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" xml:lang="en">
-Thanks,
Chris
Try ditching the xml prologue.
Can we talk about this a little bit? I just recently switched everything over on one site to using the XML Prologue as it is part of the specification. If it causes IE to go into quirks mode, will removing it still produce the desired results in browsers that it doesn't trigger quirks mode in?
- from Character sets & encodings in XHTML, HTML and CSS [w3.org]
With Internet Explorer, however, if anything appears before the DOCTYPE declaration the page is rendered in quirks mode. Because Internet Explorer users count for a very large proportion of browser users, this is a significant issue. If you want to ensure that your pages are rendered in the same way on all standards-compliant browsers, you need to think carefully about how you deal with this.
Here are the options. Obviously, if your document contains no constructs that are affected by the difference between standards vs. quirks mode this is a non-issue. If, on the other hand, that is not the case, you will have to add workarounds to your CSS to overcome the differences, or omit the XML declaration.
The XHTML specification also warns that "processing instructions are rendered on some user agents. Also, some user agents interpret the XML declaration to mean that the document is unrecognized XML rather than HTML, and therefore may not render the document as expected." You should do testing on appropriate user agents to decide whether this will be an issue for you.
Note that if you decide to omit the XML declaration you should choose either UTF-8 or UTF-16 as the encoding for the page. (See Character sets & encodings in XHTML, HTML and CSS for more information about the impact on encoding declarations.)
..........................
We assume that, because of its tendency to cause Internet Explorer to render in quirks mode, some people prefer not to use the XML declaration for XHTML served as text/html.
Good article - well worth a read.