Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the correct way to declare an HTML5 Doctype.

Tags:

html

doctype

What is the correct way to use start tag when creating with HTML5

IE: HTML 4 Strict is like this

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">  
like image 732
user6573 Avatar asked Jun 09 '12 17:06

user6573


People also ask

What is the DOCTYPE for an HTML5 document?

doctype html> in the starting of an HTML document, it represents the document in standard mode. If you don't use a doctype in the starting of an HTML document, the browser goes to the quirky mode.


2 Answers

The standard has been simplified because the previous doctypes were too cryptic. The new doctype is simply <!DOCTYPE html> . You may wonder why it is not <!DOCTYPE html5> but it is simply because it is just an update to the standard of HTML and not a new version of anything. As you can see below, all elements can now have a language attribute.

The <html> element is the root element of a document. Every document must begin with this element, and it must contain both the <head> and <body> elements.

It is considered good practice to specify the primary language of the document on this element using the lang attribute.

<!DOCTYPE html> <html lang="en">     <head>         <meta charset="utf-8">         <title>Hello World</title>     </head>     <body>         <h1>Hello World</h1>         <p>             Jamie was here.         </p>     </body> </html> 

More info: https://dev.w3.org/html5/html-author/#doctype-declaration

like image 168
Alex W Avatar answered Sep 28 '22 17:09

Alex W


you just use

<!DOCTYPE html>  <html> </html> 
like image 35
Kirill Fuchs Avatar answered Sep 28 '22 18:09

Kirill Fuchs