HTML tutorial - DOCTYPE declaration

 The first line of html coding is to specify the document type. Document type is declared by the keyword 

<! DOCTYPE               >

A sample program is given below.

<!DOCTYPE html>

<html>

<head> 

<title>

This is the first HTML program </title>

</head>

<body>

This is the sample content </body>

</html>

save this file as "sample.html" in notepad. Open the file in any browser like google chrome, Internet explorer/edge, firefox, safari and opera browser.

It shows the webpage as a window with the text "This is the sample content".

Alternate versions:

when you are using other versions of HTML or XHTML, it has some different syntax to follow....

First, the syntax of html 4.01 version is given below..

 Syntax:

<!DOCTYPE html PUBLIC  "-//W3C//DTD HTML 4.01 transitional//EN" 

                     "URL of DTD file">

Next,the syntax of XHTML is as follows....

Syntax:

<!DOCTYPE html PUBLIC  "-//W3C//DTD XHTML 1.1//EN" 

                     "URL of DTD file">

Note: 

 The "DOCTYPE" keyword is not case sensitive as all other html tags. you can use "DocType", "DOCtype", "Doctype", "doctype" instead of  "DOCTYPE".

Comments

Popular posts from this blog

How to create a XML DTD for displaying student details

How to write your first XML program?

Java NIO examples to illustrate channels and buffers.