SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    Non-Member
    Join Date
    Aug 2002
    Location
    USA
    Posts
    544
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    First line DOCTYPE necessary?

    Does it make any difference whether or not this line is included at the top of HTML docs?

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

  2. #2
    ko pročita magarac :) boccio's Avatar
    Join Date
    Oct 2003
    Location
    belgrade
    Posts
    354
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    According to html standards, every single document requires document type declaration (DTD). 'DOCTYPE' tells validator which version of HTML to use in checking the doc's syntax and indicates the level of HTML used in that document

    Your example declares the document to be HTML 4.0 Transitional. HTML 4 Transitional includes all elements and attributes of HTML 4 Strict, but adds some more...

    Anyhow, using doctype isn't obligatory, but highly recommended. Especially if you concider migrating your html files to xhml...

    stay good
    Vivvo CMS - Web publishing at your fingertips
    Mile voli disko, a ja belo kolumbijsko

  3. #3
    Ensure you finish what you sta bronze trophy John Colby's Avatar
    Join Date
    Aug 2003
    Location
    University of Central England, U.K.
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I tell my students - "If there's no !DOCTYPE the browser has to guess" And to illustrate read them lorep ipsum etc and ask them to tell me which language I'm speaking. As the most often proffered answer is Latin I can then illustrate to them wrong guesses and assumptions.

    A !DOCTYPE is obligatory if you want your code to validate.
    John
    No electrons were harmed during the creation, transmission
    or reading of this posting. However, many were excited and
    some may have enjoyed the experience.

  4. #4
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    The HTML 4.0 DOCTYPE that you posted is actually an incomplete one though. For a listing of proper DOCTYPEs go here: http://www.alistapart.com/stories/doctype/

  5. #5
    Robert Wellock silver trophybronze trophy xhtmlcoder's Avatar
    Join Date
    Apr 2002
    Location
    A Maze of Twisty Little Passages
    Posts
    6,316
    Mentioned
    60 Post(s)
    Tagged
    0 Thread(s)
    It makes the difference between proprietary HTML and HTML 4.0x.

  6. #6
    SitePoint Enthusiast abbey's Avatar
    Join Date
    Apr 2003
    Location
    Chicago
    Posts
    89
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    For more on doctype and how it can affect page rendering, see Apple's developer site. I've gotten a lot of good information from there.
    <abbey />
    HTML/XHTML/CSS coding
    Abbey Ink

  7. #7
    Your Lord and Master, Foamy gold trophy Hierophant's Avatar
    Join Date
    Aug 1999
    Location
    Lancaster, Ca. USA
    Posts
    12,305
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    It should be added that Internet Explorer 6.0 will render your page differently without a doctype as opposed if one is specified.

    Without a doctype, it has all the failings of IE 5.5 and with one it is more standards compliant.
    Wayne Luke
    ------------


  8. #8
    SitePoint Addict CeleronXL's Avatar
    Join Date
    Dec 2002
    Location
    United States of America
    Posts
    349
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Adding a DOCTYPE gives you more assurance that your page will look the same in multiple browsers.
    So hold me when I'm here
    Right me when I'm wrong
    Hold me when I'm scared
    Love me when I'm gone.

  9. #9
    SitePoint Addict naveed's Avatar
    Join Date
    Feb 2003
    Location
    Ottawa, Canada
    Posts
    230
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by W. Luke
    It should be added that Internet Explorer 6.0 will render your page differently without a doctype as opposed if one is specified.

    Without a doctype, it has all the failings of IE 5.5 and with one it is more standards compliant.
    So will Mozilla. Without a doctype, the browser renders the page in "quirks mode".
    http://www.mozilla.org/docs/web-developer/quirks/

  10. #10
    Your Lord and Master, Foamy gold trophy Hierophant's Avatar
    Join Date
    Aug 1999
    Location
    Lancaster, Ca. USA
    Posts
    12,305
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Yeah, I know but quirks mode in Mozilla is much better at getting things right then Internet Explorer is.
    Wayne Luke
    ------------


  11. #11
    SitePoint Addict CeleronXL's Avatar
    Join Date
    Dec 2002
    Location
    United States of America
    Posts
    349
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quirks mode in Mozilla is very close to standards compliant mode anyway.
    So hold me when I'm here
    Right me when I'm wrong
    Hold me when I'm scared
    Love me when I'm gone.


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
  •