SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Doctype ??

  1. #1
    SitePoint Guru DeNasio's Avatar
    Join Date
    May 2001
    Posts
    830
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Doctype ??

    Everytime I create a new HTML file in Dreamweaver, it creates the following code:

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body>
    </body>
    </html>
    I always delete the !DOCTYPE and meta lines. But I was wondering, what does these 2 lines do? Why does Dreamweaver add them to the HTML code?
    Ballot-Box.net - free polls for webmasters
    FormLog.com - free form processor

  2. #2
    Il condottiere Francesco Sforza's Avatar
    Join Date
    Mar 2004
    Location
    Cracow - Poland
    Posts
    46
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You shouldn't do that. Doctype tells the browser what spec of html you are using and this determines whether it follows standards compliant mode or it's own quirks mode. This affects the way browser is displaying html elements. Doctype is required element of a well formed html document.
    Meta tags carry info on a number of html document properties. The one in your code tells the browser that's it should use iso-8859-1 encoding for this page. There are several others that carry information about author, keywords and page description (used by search engines) and so on.

    Have a look here:
    http://www.w3.org/TR/html401/struct/global.html#h-7.4.4

    Anyway, you shouldn't remove them.

    Regards
    Piotr

  3. #3
    SitePoint Wizard megamanXplosion's Avatar
    Join Date
    Jan 2004
    Location
    Kentucky, USA
    Posts
    1,099
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    HTML has different versions, the browser renders sites differently according to the version being used. The Doctype tells the browser which version of HTML is being used, in the code above, it's HTML 4.01 Transitional. If the Doctype is missing, then the browser has to guess which version of HTML to render for and that makes the rendering of your site in different browsers very unpredictable.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •