Leave a comment

Using DOCTYPE in html document

Ever wondered why !DOCTYPE html is written at the beginning of an HTML document. Well, it’s not an HTML tag. It’s an instruction to the web browser to tell about HTML version which is used to write that particular HTML document.

<!DOCTYPE html>
		<title>This is test document</title>
		<p id="p1">First sentence</p>
		<p id="p2">Second sentence</p>


Various DOCTYPE declarations

Let us see how DOCTYPE declaration is used for different versions of HTML


<!DOCTYPE html>


For HTML 4.01 Strict

For HTML4, DOCTYPE refers to DTD since HTML4 was based on SGML (Standard Generalized Markup Language). Therefore, browser use DTD to correctly render the HTML document.

<!DOCTYPE html public "=//W3C//DTD HTML 4.01//EN" 


For HTML 4.01 Transitional

<!DOCTYPE html public "=//W3C//DTD HTML 4.01 Transitional//EN" 


For HTML 4.01 Frameset

<!DOCTYPE html public "=//W3C//DTD HTML 4.01 Frameset//EN" 

Leave a Reply

Your email address will not be published.

+ three = 8

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>