Importance of declaration in html

Asked By -10 points N/A Posted on -

What is the importance or necessity or usefulness of declaration in html or htm pages?

Answered By 20 points N/A #120142

Importance of declaration in html



The <! DOCTYPE>, located before the opening tag <HTML>, to specify the version of the standard used in the document (HTML 3.2, HTML 4.01, XHTML 2.0 …).

This is a Public Text Identifier (Public Text Identifier PTI).

Standards evolve, it is a valuable indication for browsers or decoding devices page even though many browsers accept his failure

Although it is not mandatory, you can validate input DOCTYPE giving the URL of a DTD.

This results in a uniform presentation of pages on a site, the "Declaration Document Type" indicates the tags used, the mandatory and optional attributes or rendering of style sheets


Answered By 590495 points N/A #120144

Importance of declaration in html


The <!DOCTYPE> declaration is not an HTML tag. It instructs the web browser on what version of HTML the page is written. The <!DOCTYPE> declaration should be the very first thing that appears in your HTML document and should be before the <html> tag. In the previous HTML 4.01 version, the declaration of <!DOCTYPE> refers to a DTD. This is because HTML 4.01 was based on SGML.

It is the DTD who identifies the rules or policy for the markup language so that the web browsers render or delivers the content correctly. While they based HTML 4.01 on SGML, HTML5 is not that’s why it doesn’t require a reference to a DTD. Also, specifying a <!DOCTYPE> in your HTML document will allow you to use tools like the Markup Validator that will check the syntax of your HTML document.

In case the <!DOCTYPE> declaration is missing from your HTML document, this tool won’t be able to work because it doesn’t know what kind of document is used in your web page. The most important thing about declaring <!DOCTYPE> in your HTML document is that it eliminates a lot of guessing and will trigger or set off a “standard” rendering mode.

Related Questions