SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2012
    Posts
    50
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Doctype importance and why we use doctype.

    Hi,

    I am using Colorbox and other JQuery libraries in my project.

    Doctype is important for JQuery library like Colorbox.

    I want to know importance and why we need doctype in document.

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">

    -Thanks
    Zohaib.

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,203
    Mentioned
    456 Post(s)
    Tagged
    8 Thread(s)
    Basically, if you have a doctype on your page, the browser sees it and thinks—OK, this web designer has some clue about what he's doing, so we'll render the page according to the prevailing web standards. If there's no doctype, the browser might decide to display your page in "quirks mode", as if it were built last century, and thus your layout will break in certain ways.

    It doesn't really matter which doctype you use. These days, it's common to use the so called "HTML5" version, which is more of a generic doctype:

    Code:
    <!DOCTYPE html>
    which ends up like this in the document:

    Code:
    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="utf-8">

  3. #3
    SitePoint Member
    Join Date
    Apr 2013
    Location
    Mumbai, India
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Doctype help browser understand if the page is written using strict, transitional or frameset type html. Depending upon this declaration the page code will be validated in w3c validator.

    Also doctype is necessary to make few elements of html work properly. It is an idea practice to include the doctype in your html page.

  4. #4
    SitePoint Member
    Join Date
    Jan 2012
    Location
    Chennai
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Doctype specify the web standard you have used for writing code of your website.Each doctype has different rules and constraints


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
  •