HTML document declaration - <!DOCTYPE html>

Q.  Which of the following is a declaration for an HTML document?
- Published on 25 Aug 15

a. <!DOCTYPE html>
b. <html>.....</html>
c. <body>.....</body>
d. <p>.....</p>

ANSWER: <!DOCTYPE html>
 

    Discussion

  • Nirja Shah   -Posted on 10 Nov 15
    <!DOCTYPE html>
    - This declaration must be the very first thing in the HTML document even before the <html> tag.

    - It is not an HTML tag but it is an instruction given to the web browser about the version of the HTML page.

    - This declaration refers to as a DTD in HTML 4.01 as it was based on SGML. The DTD specifies the rules for the markup language so that the browsers render the content correctly.

    - HTML5 is not based on SGML and hence it does not require a reference to a DTD.

Post your comment / Share knowledge


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)