Wednesday, November 13, 2013

Code Structure in HTML

An HTML document starts and ends with <html> and </html> tags. These tags tell the browser that the entire document is composed in HTML. Inside these two tags, the document is split into two sections:

The <head>...</head> elements, which contain information about the document such as title of the document, author of the document etc. Information inside this tag does not display outside.
The <body>...</body> elements, which contain the real content of the document that you see on your screen.

HTML Basic Tags
The basic structure for all HTML documents is simple and should include the following minimum elements or tags:

<html> - The main container for HTML pages
<head> - The container for page header information
<title> - The title of the page
<body> - The main body of the page

Remember that before an opening <html> tag, an XHTML document can contain the optional XML declaration, and it should always contain a DOCTYPE declaration indicating which version of XHTML it uses.
Now we will explain each of these tags one by one. In this tutorial you will find the terms element and tag are used interchangeably.

The <html> tag:
The <html> tag is the containing element for the whole HTML document. Each HTML document should have one <html> and each document should end with a closing </html> tag.
Following two elements appear as direct children of an <html> element:

<head>
<body>

As such, start and end HTML tags enclose all the other HTML tags you use to describe the Web page.

No comments:

Post a Comment