IE Issues with picking up DOCTYPE

E

ebade2000

I have a page that uses some CSS, problem is that the page will not
pick up the CSS because of a comment that comes before the <DOCTYPE>
declaration like so:

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

I will like to know why IE will not pick up the CSS but works fine in
FIREFOX.

If the comment is moved just below the DOCTYPE statement (i.e. <line 2>
before <line 1> ), IE picks up the CSS. But I have a template that has
to be loaded before the DOCTYPE so this is not an option for me.

(e-mail address removed)
 
D

Dylan Parry

I will like to know why IE will not pick up the CSS but works fine in
FIREFOX.

Probably because you shouldn't have *anything* before the Doctype -
unless you're using XML, which is different.

[...]
But I have a template that has to be loaded before the DOCTYPE so
this is not an option for me.

What do you mean by this? What are you putting before the doctype, and
why does it have to be there and not after it instead?

--
Dylan Parry
http://electricfreedom.org | http://webpageworkshop.co.uk

Programming, n: A pastime similar to banging one's head
against a wall, but with fewer opportunities for reward.
 
E

ebade2000

Dylan said:
(e-mail address removed) wrote: ........

What do you mean by this? What are you putting before the doctype, and
why does it have to be there and not after it instead?

It is a reservation system template that has to be loaded before the
DOCTYPE, it contains information that populates form elements within
the page. If I try to load the template after the doctype it does not
work. So in a nutshell, I have to things that are competiting for the
position of first statement in the html code.


(e-mail address removed)
 
T

Toby Inkster

ebade2000 said:
It is a reservation system template that has to be loaded before the
DOCTYPE, it contains information that populates form elements within
the page. If I try to load the template after the doctype it does not
work. So in a nutshell, I have to things that are competiting for the
position of first statement in the html code.

Contact the authors of the reservation system. Surely they've run into
this problemin the past?
 
J

John Dunlop

Dylan Parry:
Probably because you shouldn't have *anything* before the Doctype -
unless you're using XML, which is different.

That doesn't answer the question but could actually mislead. The
answer is probably that, assuming that this anecdotal evidence stands,
Internet Explorer chokes on comment declarations - maybe on anything -
before document type declarations but Firefox doesn't. That in itself
is one reason, however much weight you want to attach to it, to avoid
anything before the document type declaration.

To say that you *shouldn't* have anything before the document type
declaration, however, is potentially misleading because HTML - really
SGML - allows comment declarations, processing instructions, and
"whitespace" before the document type declaration; they can all occur
anywhere in the prolog, outside other markup declarations. And XHTML -
again, really XML - also allows those markup constructs before the
document type declaration, although XML1.1 requires an obligatory XML
declaration to come before anything else.
 
J

Jukka K. Korpela

Scripsit John Dunlop:
The
answer is probably that, assuming that this anecdotal evidence stands,
Internet Explorer chokes on comment declarations - maybe on anything -
before document type declarations but Firefox doesn't.

It's not anecdotal but a hard fact that IE goes to Quirks mode when there's
anything before the DOCTYPE declaration. The OP wanted to make it virtually
impossible to help her or him in any detail, by not posting the URL, but the
odds are that IE reads the CSS file but partly ignores it due to the Quirks
mode.
That in itself
is one reason, however much weight you want to attach to it, to avoid
anything before the document type declaration.

If some analysis shows that there _must_ be something before the DOCTYPE
declaration, then the analysis shows that some designer has thoroughly
misunderstood something. If it's really a comment, it can be removed without
changing the meaning of the document. If it isn't, then the document is
grossly malformed and all bets are off before you fix this. If it's a
pseudo-comment to be removed by a preprocessor, then a validator won't see
it at all, if things are done right.
 
E

ebade2000

Toby's
John said:
Dylan Parry:


That doesn't answer the question but could actually mislead. The
answer is probably that, assuming that this anecdotal evidence stands,
Internet Explorer chokes on comment declarations - maybe on anything -
before document type declarations but Firefox doesn't. That in itself
is one reason, however much weight you want to attach to it, to avoid
anything before the document type declaration.

To say that you *shouldn't* have anything before the document type
declaration, however, is potentially misleading because HTML - really
SGML - allows comment declarations, processing instructions, and
"whitespace" before the document type declaration; they can all occur
anywhere in the prolog, outside other markup declarations. And XHTML -
again, really XML - also allows those markup constructs before the
document type declaration, although XML1.1 requires an obligatory XML
declaration to come before anything else.

I completely agree. My understanding (even though it may be a little
bit myopic) is that as long as any statement is commented, it doesn't
matter where you put the comment. Thus, this is why I think it work in
Firefox. I think this is one of those IE issues.

With regards to Toby's statement, I spoke with the guys that originally
developed the reservation system and they can't seem to fix it. Their
rationale is that it is an old system and that they are in the process
of making much needed changes.

If you want the link to the site I can give it to you. Just ask. I did
not think it was needed because I thought anyone can replicate the
issue (i.e. just put a comment before the DOCTYPE declaration, try to
load some css and see if it does it in IE).

(e-mail address removed)
 
E

Ed Seedhouse

Dylan Parry wrote:
It is a reservation system template that has to be loaded before the
DOCTYPE, it contains information that populates form elements within
the page. If I try to load the template after the doctype it does not
work. So in a nutshell, I have to things that are competiting for the
position of first statement in the html code.

Then you can never make it look right in IE6. Sorry, that's just the
way things are.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top