Things you want to know about websites

 

Document Example

Complete Html Document

We have seen a simple Html document example in the basic section. Now we will see how to create a much complete html document.

Define the Doctype and Flavor

That's the first thing we do when writing an html document. Since I am using the Transitonal Xhtml flavor, i am just going to copy and paste the following line on top.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

The <Html> tags and the naming space

All html code is enclosed in <html> and </html> opening and closing tags. Since i am using XHtml, i am going to include a naming space as well like,

<html xmlns="http://www.w3.org/1999/xhtml">

The Head section

Now we will define the head section of the page. The head section is elcosed by <head> and </head> opening and closing tags. It includes elements like,

So type the title, define a characterset or what ever you want, then closed the head section by </head> tag.

The body section

The body section starts with a <body> tag and ends with a </body> tag.

The body section actually includes the content of the page. You can fill this section with many things that you learned in the Basic section like, headings, paragraphs, tables, lists etc.

The ending </html> tag

After you are done creating the document, end the docuemt with an </html> tag.

Example

Lets put together what we have created till now from our discussion above,

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<title> My web Page </title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>

<body>
<!--All the content of the body section will be here.-->
</body>

</html>

This is the complete structure of an html document.


Bookmark or Add to Favourites

Next :

Html-Forms

Related:

Html-Basic Document Example

Link to this page :

Copy and paste the following code in an html document to link to this page,