Re: HTML Head and DOCTYPE html



DannyBoy wrote:

> I see bits of code at the top of almost every web page source code I
> view. Such as the following examples:
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>

These tell the browser exactly how to interpret the code on your page.

Different variants of the HTML and XHTML language need to be
interpreted and rendered differently. Not including a doctype
declaration means that browsers won't know what quite how to interpret
your pages, and will trigger what is known as "Quirks mode", whereby
they take a fairly loose interpretation of the rules, which sometimes
guesses what you intended correctly, but often doesn't.

> I myself dont include this code and my site does OK.

In your browser, on your computer, at the moment. But other browsers,
on other platforms might render it differently. And who knows what
they will do next year?

> Should there be some code like this on all web pages?

Yes. Without it, there is a very high probability that some or all of
your pages will look a complete mess in one or more browsers. Simply
because the browser doesn't know how to interpret the code, because
you haven't told it what form of HTML you have used.

> Can anyone explain what the code means and does?

There is a good tutorial at http://hsivonen.iki.fi/doctype/.

--
Stevie D
\\\\\ ///// Bringing dating agencies to the
\\\\\\\__X__/////// common hedgehog since 2001 - "HedgeHugs"
___\\\\\\\'/ \'///////_____________________________________________
.