towhid001 — 2013-08-18T14:18:54-04:00 — #1
please tell me anyone why do I need to write <!..doctype> at the top of html?
what is that for?
rubble — 2013-08-18T15:03:31-04:00 — #2
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
felgall — 2013-08-18T15:39:43-04:00 — #3
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.
ralphm — 2013-08-18T22:33:00-04:00 — #4
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.
stelleninfotech — 2013-08-19T02:55:18-04:00 — #5
<!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.
alexloxton — 2013-09-27T03:57:35-04:00 — #6
This code is what html version are using you on the page. Some doc types are differently so browser may assume the page incorrectly.
jennifer9 — 2013-10-01T05:04:15-04:00 — #7
Because browser knows what HTML version the page is written.
john00 — 2013-10-05T11:42:42-04:00 — #8
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.