| |
| Overview |
| |
In this chapter you will learn
- The use of meta tag in an XHTML document
- Attributes of meta tag
|
| |
| Introduction |
| |
The previous chapters described in detail the basic tags of XHTML. This chapter will further elucidate some advanced tags that will help the designer to further customize his web page.
|
| |
Meta Tag
The <meta> tag provides some unusual information about the web page. This information includes description and keywords for search engines and refresh rates. It goes within the head tags of an HTML document. Unlike HTML, in XHTML the meta tag has to be closed. It is done so by putting a backslash (/) at the end of the tag.
Attributes of Meta Tag
Content
Content defines the information to be associated with other attributes like http-equiv or name. It takes up some text as its value.
| Example |
| <meta name=”keywords” content=”HTML, XHTML” /> |
| |
Http-equiv
Http-equiv connects the content attribute to an HTTP header. It takes up the values- content-type, expires, refresh.
| Example |
| <meta http-equiv=”refresh” content=”5” /> |
| |
Name
Name connects the content attribute to a name. It takes up the values - author, description, keyword, generator, and revised.
Example |
<meta name=”description” content=” Web based tutorial on HTML” /> |
| |
| |
| Note |
| The reason why meta tags were so important was because they were relied on by search engines to build a profile of a web page. |
| |
Example of a web page with meta tag:
(This web page is the same registration web page shown in the forms chapter. It just includes the meta tag.)
Example |
<html> |
|
<head> |
<title> My list of jokes </title> |
<meta name="description" content="Free Web tutorials on
HTML, CSS, XML, and XHTML"> |
</head> |
|
<body> |
|
<h1> My Registration Page </h1> |
|
<form name="registration" action="http://expertrating.com/registration.html"> |
|
First name: <input type=text name="realname" /> <br/> |
Last name: <input type=text name="sirname" /> <br/> |
Password: <input type=password name="pass"/> <br/> |
Re-Type Password: <input type=password name="repass"/> |
|
<h2>Additional Information </h2> |
|
SEX<br/> |
<select name="sex"> |
<option value="001"> Male </option> |
<option value="002"> Female </option> |
</select><br/> |
|
SELECTION OF JOKES<br/> |
<select name=”jokenumber”> |
<optgroup label=”Game jokes”> |
<option value=”001”> Cricket jokes </option> |
<option value=”002”> Golf jokes </option> |
</optgroup> |
|
<optgroup label=”Other jokes”> |
<option value=”111”> Classic jokes </option> |
<option value=”112”> Short jokes </option> |
</optgroup> |
</select><br/> |
|
|
<label for=”moreinfo”> Do you want more information on jokes? </label> |
<input type=checkbox name=”moreinfo” id=”moreinfo” /><br/><br/> |
|
Enter your comments: |
<textarea name=”comments” cols=40 rows=3 wrap=soft> |
</textarea><br/><br/> |
|
<button type=reset> Reset </button><br/> |
<button type=submit>Send This </button> |
</form> |
|
</body> |
</html> |
| |
This is how the web page will look:

| |
| Summary |
| |
In this chapter you have learnt
- The meta tag provides some unusual information about the web page.
- The information in meta tag includes description and keywords for search engines and refresh rates.
- Content attribute of meta tag defines the information to be associated with other attributes like http-equiv or name.
- Http-equiv connects the content attribute to an HTTP header. It takes up the values- content-type, expires, refresh.
|
| |
| Review Questions |
| |
Question 1
What does the meta tag do?
Answer
It provides some unusual information about the web page.
Question 2
What information is there in the meta tag?
Answer
The information in meta tag includes description and keywords for search engines and refresh rates.
Question 3
Give an example of meta tag?
Answer
<meta name="description" content="Free Web tutorials on |
HTML, CSS, XML, and XHTML"> |
|
|
|