[thelist] Always use a DOCTYPE (was: Horizontal scrollbarinIE 6.0)

MRC webmaster at equilon-mrc.com
Tue Feb 26 15:16:00 CST 2002


Mark,

> >   For HTML documents, removing the URI for the doctype is perfectly
valid,
> > e.g.:
> >
> > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>
> This works for the HTML 4.01 Transitional specification, but not the
current
> HTML specifications (XHTML 1.0 or XHTML 1.1) or HTML 4.01 Strict.

    That is not accurate about HTML Strict. As I noted, valid HTML --
whether Strict, Transitional, or Frameset -- does not require the URI, or
system identifier, within the doctype declaration. There is nothing in the
HTML 4.01 recommendation that requires it, and the W3C validator validates
documents without it.

> > In point of fact, few if any browsers actually rely on the dtd specified
> > in the doctype in order to render a page. Instead, they rely on their
own
> > internal rules to render the page, whether in spec-compliance mode or in
a
> > so-called "quirks" mode.
>
> As I said, this is currently the case. What happens next year, when IE 7
is
> released? Surely it's better to make sure that code is correctly formatted
> now, so that code doesn't have to be reworked to render correctly in new
> browsers, as they're released?

    IE 7 (or 6.5, as some have speculated) will surely render html that
includes a doctype declaration without a system identifier. As will IE 8, 9,
and 10.
    Keep in mind that you can still write valid code that does not trigger
the so-called "standards-compliant" mode of most browsers. And the
standards-compliant modes of current (and likely future) browsers are not
without quirks of their own! Although IE 6 in standards-compliance mode and
Netscape 6 in standards-compliance mode will likely render _most_ aspects of
a page very similarly, they do not render _all_ aspects similarly.
Cross-browser workarounds are not yet a thing of the past, if they ever will
be.
    Bottom line: 1) write spec-compliant code; 2) don't be oblivious to how
your spec-compliant code actually displays in real-world UAs; and 3) don't
assume that how a browser renders a page in its standards-compliant mode is
the end-all in standards-compliance.

James Aylard




More information about the thelist mailing list