valid doctype

+1 Parul Bhagat · August 22, 2015
If I do not write any of that stuff in <!doctype html >tag to make it valid then will it make any difference? Will the website which I make work perfectly without all that specification ?

Post a Reply

Replies

Oldest  Newest  Rating
0 Lotfi Ace · August 23, 2015
Always have the doctype. It tells the browser to render the page in standards mode. If you dont put it on it renders the webpage in quirks page. This is only for HTML. With XML it renders the page in standards mode automatically.
0 Parul Bhagat · August 24, 2015
So this means if I only write <!doctype html> and nothing else inside it  my website will work perfectly ?(If the code is in XHTML)
0 Lotfi Ace · August 24, 2015
https://en.wikipedia.org/wiki/XHTML

If you scroll down to XML declaration it says:

The declaration may be optionally omitted because it declares as its encoding the default encoding. However, if the document instead makes use of XML 1.1 or another character encoding, a declaration is necessary. Internet Explorer prior to version 7 enters quirks mode, if it encounters an XML declaration in a document served as 
text/html

.You should be using HTML5 anyway. XHTML is old. Also, if youre too lazy to write the doctype at the beginning then use the IDE Webstorm from the Jetbrains website. Whenever you create a html file there it automatically writes the doctype and the basic tags such as html,body,head.
  • 1

HTML / CSS / Web Design

107,348 followers
About

Discuss, share, ask, learn and teach HTML5 and CSS3.

Links
Moderators