HTML Head and Body

HTML Head and Body

Sponsored Ads

The format of Html document is

Sponsored Ads

<!DOCTYPE html>
<html>
<head>
	Head Content
</head>
<body>
	Body Content
</body>
</html>

The html document starts with the Dctype declaration. We have already discussed about Dctype declaration. You can read it hear.

Then comes the <html> tag. The complete html document is written inside the <html> tag. Or the html document starts with the <html> tag and ends with </html> tag except the Dctype declaration which is at the top of the document before <html> tag.

Now inside the html tag you have the head section and the body section. i.e. the html document is divided into two parts the head and body.

Head Section

The html head section contains all the non-printing sections of an html document. Anything written in the head section will not be displayed by the browser.

The head section of the html document is written between the <head>…..</head> tag.

Sponsored Ads

The head section of the document is used to add all meta information, css codes, javascript codes, links to css files and javascript files etc.

Example

<head>
<title>Head section of a html document</title>
<meta name="description" content="Meta content goes here ">
<style>
…..Css style goes here……..
</style>
<script>
……….Javascript code goes here……
</script>
</head>

The third line in the code is a meta tag-the meta description tag. There are other meta tags too. You can learn about meta tags in the later chapters and about css and javascript in the respective tutorials.

The Body Section

The body section contains all the displayable text or printable text of the html document. If you want to display anything in the web page then you should write that in the body section of the html document.

The content of the body section is written between the <body>……</body> tags.

In order to arrange the content inside the body section we use special html tags like the <p> tag for paragraph, <h1>….<h6> tags for the heading <div> tag tag for division and all.

Sponsored Ads

Example

<body>
<h1> This is the main heading</h1>
<h2>This is a subheading</h2>
<p>This is a paragraph</p>
</body>

Sponsored Ads

%d bloggers like this: