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"
___\\\\\\\'/ \'///////_____________________________________________
.



Relevant Pages

  • Re: Massive HTML coding errors
    ... HTML Dom http://www.w3schools.com/htmldom/dom_reference.asp ' ... JUST BECAUSE YOU SAW SOME SOURCE CODE ... browser and click on "SOURCE". ... libraries might charge a small fee but most are free. ...
    (comp.infosystems.www.authoring.html)
  • Re: Zero Filling Integer
    ... > Are additional spaces somehow getting surpressed via the HTML? ... code would appear in the browser and it would be an almighty mess. ... If you look at the source code of the generated page you ... a table with the cell align property set eg: ...
    (comp.lang.php)
  • Re: Problem with ASP.NET website. Does not display anything but a
    ... between getting a blank page and having no HTML sent to the client. ... Also, HTML errors NEVER produce error messages in a browser, so I would ... view the source code of that page in the browser. ... I am working on a website and suddenly this afternoon i cannot view ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Dealing with PHP Files
    ... language which is interpreted at the server when the page is requested. ... uploaded to the author's server to generate the html page. ... The OP doesn't have anything to do with the source code. ... Unfortunately the only name the browser has is the one in the URL, ...
    (comp.sys.mac.apps)
  • Re: Tab to end of previous line perl print
    ... writing a CGI script, and that your output was being viewed through a ... View the source code of your HTML output. ... go to the next line of your browser, you need to print a line-breaking ...
    (perl.beginners)