SitePoint Sponsor

User Tag List

Results 1 to 8 of 8

Thread: Html help

  1. #1
    SitePoint Member
    Join Date
    Jul 2013
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Html help

    please tell me anyone why do I need to write <!..doctype> at the top of html?

    what is that for?

  2. #2
    SitePoint Mentor silver trophy
    Rubble's Avatar
    Join Date
    Dec 2005
    Location
    Cambridge, England
    Posts
    2,435
    Mentioned
    82 Post(s)
    Tagged
    3 Thread(s)
    It is so the browser knows what html version the page is written. Some doctypes do things in different ways and if not stated the browser may render the page incorrectly.

    The types are listed here

  3. #3
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,870
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    If you are using HTML 2 through HTML 4 then that tag is an SGML tag that identifies that the language the page is written in is a version of HTML that follows the SGML standards. If you use the longer version of the doctype in those cases then you are identifying exactly which version of HTML the page uses and attach the actual SGML specification for that version that the page could use to render the content (if browsers actually used the standards to determine how to process the HTML). With HTML 5 it is merely an HTML tag that identifies that your page follows the standards and is not to be rendered in quirks mode.

    With XHTML 1 it has the same meaning as for HTML 2 through 4. For XHTML 5 you do not need that tag at all as version 5 does not follow the SGML standard and XHTML does not have a quirks mode.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  4. #4
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,324
    Mentioned
    462 Post(s)
    Tagged
    8 Thread(s)
    Quote Originally Posted by Towhid001 View Post
    please tell me anyone why do I need to write <!..doctype> at the top of html?

    what is that for?
    As felgall said above, if you don't have a doctype declaration like that, the browser goes into "quirks mode". That basically means that the browser will assume you are using really, really old and outdated coding practices, and will thus render the page like browsers did back in the very old days.

  5. #5
    SitePoint Enthusiast stelleninfotech's Avatar
    Join Date
    Apr 2013
    Location
    India
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <!DOCTYPE> declaration must be the very first thing in your HTML document, before the <html> tag.The <!DOCTYPE> declaration is not an HTML tag; it is an instruction to the web browser about what version of HTML the page is written in.

  6. #6
    SitePoint Member
    Join Date
    Sep 2013
    Location
    Australia
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This code is what html version are using you on the page. Some doc types are differently so browser may assume the page incorrectly.

  7. #7
    SitePoint Member Jennifer9's Avatar
    Join Date
    Sep 2013
    Location
    Houston, Texas.
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Towhid001 View Post
    please tell me anyone why do I need to write <!..doctype> at the top of html?

    what is that for?

    Because browser knows what HTML version the page is written.

    Jennifer

  8. #8
    SitePoint Member
    Join Date
    Sep 2013
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <!doctype html>
    is the tag of the html 5 which is latest developed by the html for the design of the websites for the mobiles and tablets.


Tags for this Thread

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
  •