{"id":2945,"date":"2022-12-27T12:39:37","date_gmt":"2022-12-27T12:39:37","guid":{"rendered":"https:\/\/learnscripting.org\/?p=2945"},"modified":"2022-12-28T15:01:27","modified_gmt":"2022-12-28T15:01:27","slug":"the-html-doctype","status":"publish","type":"post","link":"https:\/\/learnscripting.org\/the-html-doctype\/","title":{"rendered":"The HTML DOCTYPE"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">The <code>DOCTYPE<\/code> in HTML is an instruction that tells the web browser which version of HTML the document is written in. It is the first line of an HTML document, and is usually placed at the very top of the file, before the <code>&lt;html&gt;<\/code> element.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>DOCTYPE<\/code> is not an HTML element, and does not have a closing tag. It is used to tell the web browser which version of HTML to use when rendering the document.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">There are several different versions of HTML, each with its own <code>DOCTYPE<\/code> declaration. The most common <code>DOCTYPE<\/code> declarations are:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>&lt;!DOCTYPE html&gt;<\/code>: This <code>DOCTYPE<\/code> is used for HTML5 documents.<\/li>\n\n\n\n<li><code>&lt;!DOCTYPE HTML PUBLIC \"-\/\/W3C\/\/DTD HTML 4.01\/\/EN\" \"http:\/\/www.w3.org\/TR\/html4\/strict.dtd\"&gt;<\/code>: This <code>DOCTYPE<\/code> is used for HTML 4.01 Strict documents.<\/li>\n\n\n\n<li><code>&lt;!DOCTYPE HTML PUBLIC \"-\/\/W3C\/\/DTD HTML 4.01 Transitional\/\/EN\" \"http:\/\/www.w3.org\/TR\/html4\/loose.dtd\"&gt;<\/code>: This <code>DOCTYPE<\/code> is used for HTML 4.01 Transitional documents.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Here is an example of an HTML document with a <code>DOCTYPE<\/code> declaration:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code>&lt;!DOCTYPE html>\n&lt;html>\n  &lt;head>\n    &lt;title>My Page&lt;\/title>\n  &lt;\/head>\n  &lt;body>\n    &lt;h1>Welcome to My Page&lt;\/h1>\n    &lt;p>Here is some information about me:&lt;\/p>\n    &lt;ul>\n      &lt;li>Name: John&lt;\/li>\n      &lt;li>Age: 30&lt;\/li>\n      &lt;li>Location: New York&lt;\/li>\n    &lt;\/ul>\n  &lt;\/body>\n&lt;\/html>\n<\/code><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">In this example, the <code>DOCTYPE<\/code> declaration is <code>&lt;!DOCTYPE html&gt;<\/code>, which tells the web browser that the document is written in HTML5.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It&#8217;s important to include a <code>DOCTYPE<\/code> declaration in your HTML documents, as this will help the web browser correctly interpret and render the document.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">That&#8217;s it! You now know what the HTML <code>DOCTYPE<\/code> is and how to use it in your HTML documents.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The DOCTYPE in HTML is an instruction that tells the web browser which version of HTML the document is written in. It is the first line of an HTML document, and is usually placed at the very top of the file, before the &lt;html&gt; element. The DOCTYPE is not an HTML element, and does not &hellip;<\/p>\n","protected":false},"author":2,"featured_media":3399,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"rop_custom_images_group":[],"rop_custom_messages_group":[],"rop_publish_now":"initial","rop_publish_now_accounts":{"facebook_2613112545524186_272996453239123":"","twitter_aTo5NzY3MTIyNTIwMzEwNTM4MjQ7_976712252031053800":""},"rop_publish_now_history":[],"rop_publish_now_status":"pending","footnotes":""},"categories":[13],"tags":[],"class_list":["post-2945","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-html"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>The HTML DOCTYPE - Learn Scripting<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/learnscripting.org\/the-html-doctype\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"The HTML DOCTYPE - Learn Scripting\" \/>\n<meta property=\"og:description\" content=\"The DOCTYPE in HTML is an instruction that tells the web browser which version of HTML the document is written in. It is the first line of an HTML document, and is usually placed at the very top of the file, before the &lt;html&gt; element. The DOCTYPE is not an HTML element, and does not &hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/learnscripting.org\/the-html-doctype\/\" \/>\n<meta property=\"og:site_name\" content=\"Learn Scripting\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/profile.php?id=100064270142636\" \/>\n<meta property=\"article:published_time\" content=\"2022-12-27T12:39:37+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-12-28T15:01:27+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/learnscripting.org\/wp-content\/uploads\/2022\/12\/13-1280x720.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t<meta property=\"og:image:height\" content=\"720\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"master\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"master\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/learnscripting.org\\\/the-html-doctype\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/learnscripting.org\\\/the-html-doctype\\\/\"},\"author\":{\"name\":\"master\",\"@id\":\"https:\\\/\\\/learnscripting.org\\\/#\\\/schema\\\/person\\\/bf3c4da686af137370060664be0d6d23\"},\"headline\":\"The HTML DOCTYPE\",\"datePublished\":\"2022-12-27T12:39:37+00:00\",\"dateModified\":\"2022-12-28T15:01:27+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/learnscripting.org\\\/the-html-doctype\\\/\"},\"wordCount\":186,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/learnscripting.org\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/learnscripting.org\\\/the-html-doctype\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/learnscripting.org\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/13-1280x720.jpg\",\"articleSection\":[\"Html\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/learnscripting.org\\\/the-html-doctype\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/learnscripting.org\\\/the-html-doctype\\\/\",\"url\":\"https:\\\/\\\/learnscripting.org\\\/the-html-doctype\\\/\",\"name\":\"The HTML DOCTYPE - Learn Scripting\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/learnscripting.org\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/learnscripting.org\\\/the-html-doctype\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/learnscripting.org\\\/the-html-doctype\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/learnscripting.org\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/13-1280x720.jpg\",\"datePublished\":\"2022-12-27T12:39:37+00:00\",\"dateModified\":\"2022-12-28T15:01:27+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/learnscripting.org\\\/the-html-doctype\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/learnscripting.org\\\/the-html-doctype\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/learnscripting.org\\\/the-html-doctype\\\/#primaryimage\",\"url\":\"https:\\\/\\\/learnscripting.org\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/13-1280x720.jpg\",\"contentUrl\":\"https:\\\/\\\/learnscripting.org\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/13-1280x720.jpg\",\"width\":1280,\"height\":720},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/learnscripting.org\\\/the-html-doctype\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/learnscripting.org\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"The HTML DOCTYPE\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/learnscripting.org\\\/#website\",\"url\":\"https:\\\/\\\/learnscripting.org\\\/\",\"name\":\"Learn Scripting\",\"description\":\"Coding Knowledge Unveiled: Empower Yourself\",\"publisher\":{\"@id\":\"https:\\\/\\\/learnscripting.org\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/learnscripting.org\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/learnscripting.org\\\/#organization\",\"name\":\"Learn Scripting\",\"url\":\"https:\\\/\\\/learnscripting.org\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/learnscripting.org\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/learnscripting.org\\\/wp-content\\\/uploads\\\/2022\\\/03\\\/cropped-ls-600x600-1-512x512.jpg?fit=512%2C512&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/learnscripting.org\\\/wp-content\\\/uploads\\\/2022\\\/03\\\/cropped-ls-600x600-1-512x512.jpg?fit=512%2C512&ssl=1\",\"width\":512,\"height\":512,\"caption\":\"Learn Scripting\"},\"image\":{\"@id\":\"https:\\\/\\\/learnscripting.org\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/profile.php?id=100064270142636\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/learnscripting.org\\\/#\\\/schema\\\/person\\\/bf3c4da686af137370060664be0d6d23\",\"name\":\"master\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/1a1a1b8874d703e67ae938d527c63bbdf31a167356dc0754dd70439744ff5bba?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/1a1a1b8874d703e67ae938d527c63bbdf31a167356dc0754dd70439744ff5bba?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/1a1a1b8874d703e67ae938d527c63bbdf31a167356dc0754dd70439744ff5bba?s=96&d=mm&r=g\",\"caption\":\"master\"},\"url\":\"https:\\\/\\\/learnscripting.org\\\/author\\\/master\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"The HTML DOCTYPE - Learn Scripting","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/learnscripting.org\/the-html-doctype\/","og_locale":"en_US","og_type":"article","og_title":"The HTML DOCTYPE - Learn Scripting","og_description":"The DOCTYPE in HTML is an instruction that tells the web browser which version of HTML the document is written in. It is the first line of an HTML document, and is usually placed at the very top of the file, before the &lt;html&gt; element. The DOCTYPE is not an HTML element, and does not &hellip;","og_url":"https:\/\/learnscripting.org\/the-html-doctype\/","og_site_name":"Learn Scripting","article_publisher":"https:\/\/www.facebook.com\/profile.php?id=100064270142636","article_published_time":"2022-12-27T12:39:37+00:00","article_modified_time":"2022-12-28T15:01:27+00:00","og_image":[{"width":1280,"height":720,"url":"https:\/\/learnscripting.org\/wp-content\/uploads\/2022\/12\/13-1280x720.jpg","type":"image\/jpeg"}],"author":"master","twitter_card":"summary_large_image","twitter_misc":{"Written by":"master","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/learnscripting.org\/the-html-doctype\/#article","isPartOf":{"@id":"https:\/\/learnscripting.org\/the-html-doctype\/"},"author":{"name":"master","@id":"https:\/\/learnscripting.org\/#\/schema\/person\/bf3c4da686af137370060664be0d6d23"},"headline":"The HTML DOCTYPE","datePublished":"2022-12-27T12:39:37+00:00","dateModified":"2022-12-28T15:01:27+00:00","mainEntityOfPage":{"@id":"https:\/\/learnscripting.org\/the-html-doctype\/"},"wordCount":186,"commentCount":0,"publisher":{"@id":"https:\/\/learnscripting.org\/#organization"},"image":{"@id":"https:\/\/learnscripting.org\/the-html-doctype\/#primaryimage"},"thumbnailUrl":"https:\/\/learnscripting.org\/wp-content\/uploads\/2022\/12\/13-1280x720.jpg","articleSection":["Html"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/learnscripting.org\/the-html-doctype\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/learnscripting.org\/the-html-doctype\/","url":"https:\/\/learnscripting.org\/the-html-doctype\/","name":"The HTML DOCTYPE - Learn Scripting","isPartOf":{"@id":"https:\/\/learnscripting.org\/#website"},"primaryImageOfPage":{"@id":"https:\/\/learnscripting.org\/the-html-doctype\/#primaryimage"},"image":{"@id":"https:\/\/learnscripting.org\/the-html-doctype\/#primaryimage"},"thumbnailUrl":"https:\/\/learnscripting.org\/wp-content\/uploads\/2022\/12\/13-1280x720.jpg","datePublished":"2022-12-27T12:39:37+00:00","dateModified":"2022-12-28T15:01:27+00:00","breadcrumb":{"@id":"https:\/\/learnscripting.org\/the-html-doctype\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/learnscripting.org\/the-html-doctype\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/learnscripting.org\/the-html-doctype\/#primaryimage","url":"https:\/\/learnscripting.org\/wp-content\/uploads\/2022\/12\/13-1280x720.jpg","contentUrl":"https:\/\/learnscripting.org\/wp-content\/uploads\/2022\/12\/13-1280x720.jpg","width":1280,"height":720},{"@type":"BreadcrumbList","@id":"https:\/\/learnscripting.org\/the-html-doctype\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/learnscripting.org\/"},{"@type":"ListItem","position":2,"name":"The HTML DOCTYPE"}]},{"@type":"WebSite","@id":"https:\/\/learnscripting.org\/#website","url":"https:\/\/learnscripting.org\/","name":"Learn Scripting","description":"Coding Knowledge Unveiled: Empower Yourself","publisher":{"@id":"https:\/\/learnscripting.org\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/learnscripting.org\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/learnscripting.org\/#organization","name":"Learn Scripting","url":"https:\/\/learnscripting.org\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/learnscripting.org\/#\/schema\/logo\/image\/","url":"https:\/\/i0.wp.com\/learnscripting.org\/wp-content\/uploads\/2022\/03\/cropped-ls-600x600-1-512x512.jpg?fit=512%2C512&ssl=1","contentUrl":"https:\/\/i0.wp.com\/learnscripting.org\/wp-content\/uploads\/2022\/03\/cropped-ls-600x600-1-512x512.jpg?fit=512%2C512&ssl=1","width":512,"height":512,"caption":"Learn Scripting"},"image":{"@id":"https:\/\/learnscripting.org\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/profile.php?id=100064270142636"]},{"@type":"Person","@id":"https:\/\/learnscripting.org\/#\/schema\/person\/bf3c4da686af137370060664be0d6d23","name":"master","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/1a1a1b8874d703e67ae938d527c63bbdf31a167356dc0754dd70439744ff5bba?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/1a1a1b8874d703e67ae938d527c63bbdf31a167356dc0754dd70439744ff5bba?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/1a1a1b8874d703e67ae938d527c63bbdf31a167356dc0754dd70439744ff5bba?s=96&d=mm&r=g","caption":"master"},"url":"https:\/\/learnscripting.org\/author\/master\/"}]}},"_links":{"self":[{"href":"https:\/\/learnscripting.org\/wp-json\/wp\/v2\/posts\/2945","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/learnscripting.org\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/learnscripting.org\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/learnscripting.org\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/learnscripting.org\/wp-json\/wp\/v2\/comments?post=2945"}],"version-history":[{"count":2,"href":"https:\/\/learnscripting.org\/wp-json\/wp\/v2\/posts\/2945\/revisions"}],"predecessor-version":[{"id":3406,"href":"https:\/\/learnscripting.org\/wp-json\/wp\/v2\/posts\/2945\/revisions\/3406"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/learnscripting.org\/wp-json\/wp\/v2\/media\/3399"}],"wp:attachment":[{"href":"https:\/\/learnscripting.org\/wp-json\/wp\/v2\/media?parent=2945"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/learnscripting.org\/wp-json\/wp\/v2\/categories?post=2945"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/learnscripting.org\/wp-json\/wp\/v2\/tags?post=2945"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}