The <body> Element:
The <body> element appears after the <head> element and contains the part of the Web page that you actually see in the main browser window, which is sometimes referred to as body content.
A <body> element may contain anything from a couple of paragraphs under a heading to more complicated layouts containing forms and tables.
Most of what you will be learning in this and the following five chapters will be written between the opening <body> tag and closing </body> tag.
Example:
Here is the example of using body tag.
<body> <p>This is a paragraph tag.</p> </body>
Putting all together:
Now if we will put all these tags together, it will constitute a complete HTML document as follows:
<html>
<head>
<title>HTML Basic tags</title>
<meta name="Keywords" content="HTML, Web Pages" />
<meta name="description" content="HTML Basic Tags" />
<base href="http://www.tutorialspoint.com" />
<link rel="stylesheet" type="text/css" href="tp.css" />
<script type="text/javascript"> _uacct = "UA-232293"; urchinTracker(); </script>
</head>
<body>
<p>This is a paragraph tag.</p>
</body>
</html>
HTML Meta Tags
HTML lets you specify metadata - information about a document rather than document content - in a variety of ways. The META element can be used to include name/value pairs describing properties of the HTML document, such as author, Expiry Date, a list of key words, author etc.
The <meta> tag is an empty element and so does not have a closing tag, rather, <meta> tags carry information within attributes, so you need a forward slash character at the end of the element.
Metadata provided by using meta tag is a very important part of the web. It can assist search engines in finding the best match when a user performs a search. Search engines will often look at any metadata attached to a page - especially keywords - and rank it higher than another page with less relevant metadata, or with no metadata at all.
Adding Meta Tags to Your Documents:
You can add metadata to your web pages by placing <meta> tags between the <head> and </head> tags. The can include the following attributes:
Adding Meta Tags to Your Documents:
You can add metadata to your web pages by placing <meta> tags between the <head> and </head> tags. The can include the following attributes:
NOTE: Core attributes for all the elements are discussed in next chapter.
Meta Tag Examples:
Let's see few important usage of Meta Tags.
Specifying Keywords:
We specify keywords which will be used by the search engine to search a web page. So using following tag you can specify important keywords related to your page.
<head> <meta name="keywords" content="HTML, meta tags, metadata" /> </head>
Document Description:
This is again important information and many search engine use this information as well while searching a web page. So you should give an appropriate description of the page.
<head> <meta name="description" content="Learn about Meta Tags." /> </head>
Document Revision date:
This information tells about last time the document was updated.
<head>
<meta name="revised" content="Tutorialspoint, 6/12/2006" />
</head>
Document Refreshing:
You can specify a duration after which your web page will keep refreshing. If you want your page keep refreshing after every 10 seconds then use the following syntax.
<head>
<meta http-equiv="refresh" content="10" />
</head>
Page Redirection:
You can specify a page redirection using Meta Tag. Following is an example of redirecting current page to another page. You can specify a duration after which page will be redirected.
<head>
<meta http-equiv="refresh" content="10; url=http://www.tutorialspoint.com" />
</head>
If you don't provide a duration then page will be redirected immediately.
Setting Cookies:
You can use Meta Tag to store cookies on client side later information can be used by then Web Server to track a site visitor.
<head>
<meta http-equiv="cookie" content="userid=xyz; expires=Wednesday, 08-Aug-00 23:59:59 GMT; />
</head>
If you do not include the expiration date and time, the cookie is considered a session cookie and will be deleted when the user exits the browser.
Setting Author Name:
You can set an author name in a web page using Meta Tag. See an example below:
<head>
<meta name="author" content="Monu Kumar" />
</head>
If you do not include the expiration date and time, the cookie is considered a session cookie and will be deleted when the user exits the browser.
No comments:
Post a Comment