HTML – List Of XHTML Tags
This chapter will give you a partially complete list of XHTML tags.
Here you will find a large amount of XHTML tags, some that we’ve already seen in the lessons, and some new ones. Generally, the tags we haven’t seen are used quite rarely. Maybe you’ll find something you need in the list
You can also use this page as a reminder when you’re developing your web site
This page does not have every XHTML tag and it’s done on purpose. I prefer to put less tags and only put the ones that are useful for web development.
First Level Tags
First level tags are the ones that structure a XHTML page. They are indispensable to have the minimum
code for a web page.
| Tags | Description |
|---|---|
| <html> |
Main tag of a web page.
Most of the time your <html> tag will look something like this : Code : HTML <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> </head> |
| <head> | The header of the page |
| <body> | The body of the page |
The Minimum Code Of An XHTML Page
Here you will find the minimum amount of code need to create an XHTML page :
Code : HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Title Of The Site</title>
<meta-equiv="Content-Type" content="text/xhtml; charset=iso-8859-1" />
</head>
<body>
</body>
</html>
Header Tags
All these tags go in the header of the page, meaning between <head> and </head>.
| Tags | Description |
|---|---|
| <link /> |
This tag allows you to indicate several pieces of information for the page. Code : HTML <link rel="stylesheet" media="screen" type="text/css" title="My Design" href="style.css" /> It can also be used for 2 or 3 other things : Code : HTML <!-- Home page of the site --> <link rel="start" title="Home" href="index.html" /> <!-- Help page of the site --> <link rel="help" title="Help page" href="help.html" /> <!-- RSS feed of the site --> <link rel="alternate" type="application/rss+xml" title="My site's news" href="news.xml" /> <!-- Icon of the site (favicon) --> <link rel="shortcut icon" type="image/x-icon" href="favicon.ico" /> The favicon is an icon that is generally shown to the left of your site’s address. It’s a way to personalise your site a bit more. As for the RSS feed, it’s a way for people to follow your site’s news by using a special program (Firefox can do it). RSS feeds are normally generated using PHP (if you can only do HTML/CSS you won’t really be able to use it). |
| <meta /> |
This tag defines the properties of a web page. Code : HTML <-- Author of the page --> <meta name="author" content="Euro PC Solutions" /> <-- Description of the page --> <meta name="description" content="The personal files of NASA" /> <-- Key words of the page --> <meta name="keywords" content="experiments, physics, chemistry, laboratory" /> <-- Contact address --> <meta name="reply-to" content="myaddress@email.com" /> <-- Stop the browser from putting the page in the cache --> <meta http-equiv="pragma" content="no-cache" /> <-- Character map --> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <-- Automatically refresh the page after 10 seconds --> <meta http-equiv="refresh" content="10; URL=http://www.mysite.com" /> Generally, the meta is used for setting the character map, and the page description and keywords. |
| <script> |
Allows you to include a script. Code : HTML
<script type="text/javascript">
/* Put your script here */
</script>
|
| <style> |
Lets you write CSS code in the page. Example : Code : HTML
<style type="text/css">
/* Put your CSS code here */
</style>
|
| <title> |
The title of the web page. Code : HTML <title>The chemistry experiments of Mr Smith</title> |
Tags For Text Structure
| Tag | Type | Description |
|---|---|---|
| <acronym> | Inline |
Is used to define acronyms like C.I.A. Code : HTML <acronym title="Central Intelligence Agency">C.I.A.</acronym> |
| <blockquote> | Block |
Long quotation. Code :HTML
<blockquote>
<p>
Text of the quotation.
</p>
</blockquote>
|
| <cite> | Inline | Average quotation. |
| <q> | Inline | Short quotation. |
| <sup> | Inline | Put the text in superscript. |
| <sub> | Inline | Put the text in subscript. |
| <strong> | Inline |
Adds a lot of value to the text. |
| <em> | Inline |
Adds a bit of value to the text. |
| <h6> | Block | Very unimportant title |
| <h5> | Block | Unimportant title |
| <h4> | Block | Not very important title |
| <h3> | Block | Average title |
| <h2> | Block | Important title |
| <h1> | Block | Very important title |
| <img /> | Inline |
Inserts an image. Code : HTML <img src="images/smiley.png" alt="smiley face" /> |
| <a> | Inline |
Hypertext link. Code : HTML <a href="otherpage.html">Go to the other page</a> |
| <br /> | Inline | Goes to a new line. |
| <p> | Block | Creates a paragraph. |
| <hr /> | Block | Creates a horizontal separation line. |
| <address> | Block |
Lets you insert an address or the author of a document. |
| <del> | Inline |
Lets you indicate text that has been deleted. |
| <ins> | Inline |
Allows you to indicate text that has been added. |
| <dfn> | Inline | Indicates a definition. |
| <kbd> | Inline | Indicates a code that the visitor must write. |
| <pre> | Block | The text inside the pre tag will be shown just like in the source code (including spaces and line breaks). A font of the same size is used everywhere. |
List Tags
This part includes all the tags that allow you to create lists (bullet point lists, numbered lists, definition lists…).
| Tag | Type | Description |
|---|---|---|
| <ul> | Block |
Unordered bullet point list. You must use <li></li> for each element of the list. Example : Code : HTML
<ul>
<li>An element</li>
<li>Another element</li>
</ul>
|
| <ol> | Block |
Ordered list (with numbers). You must use <li></li> for each element of the list. Example : Code : HTML
<ol>
<li>Element 1</li>
<li>Element 2</li>
</ol>
|
| <li> | list-item |
Lets you create a new element in a list. |
| <dl> | Block |
Definition list. You must alternate each term (<dt>) with a definition (<dd>). Example : Code : HTML
<dl>
<dt>Door</dt>
<dd>An opening in a wall to let people enter and exit</dd>
<dt>Theatre</dt>
<dd>Place for putting on shows</dd>
</dl>
|
| <dt> | Block | Term to define |
| <dd> | Block | Definition of the term |
Table Tags
| Tag | Type | Description |
|---|---|---|
| <table> | Block |
Surrounds the contents of the table. Here’s a simple example : Code : HTML
<table>
<caption>Passengers of flight 377</caption>
<tr>
<th>Name</th>
<th>Age</th>
<th>Country</th>
</tr>
<tr>
<td>Carmen</td>
<td>33 Yrs Old</td>
<td>Spain</td>
</tr>
<tr>
<td>Michelle</td>
<td>26 Yrs Old</td>
<td>United States</td>
</tr>
<tr>
<td>Ben</td>
<td>19 Yrs Old</td>
<td>England</td>
</tr>
</table>
|
| <caption> | - | Sets a title for the table |
| <tr> | - | Line of a table |
| <th> | - | Header cell of a table (contents are generally bold) |
| <td> | - | Cell of a table |
| <thead> | - |
Optional tag that allows you to insert a header in the table.
|
| <tbody> | - | Optional tag to insert the body of a table |
| <tfoot> | - | Optional tag to insert the footer of a table. |
Form Tags
| Tag | Type | Description |
|---|---|---|
| <form> | Block |
Surrounds the contents of a form.
|
| <fieldset> | Block |
Groups several elements of a form. To give a title to the group use the legend tag. |
| <legend> | Inline |
Title of a group in a form. |
| <label> | Inline |
Title of an element in a form. |
| <input /> | Inline |
Input area. Code : HTML <!-- Text input with one line --> <input type="text" /> <!-- Password (text is hidden) --> <input type="password" /> <!-- Send a file --> <input type="file" /> <!-- Box to tick --> <input type="checkbox" /> <!-- Option button --> <input type="radio" /> <!-- Send button --> <input type="submit" /> <!-- Reset button --> <input type="reset" /> <!-- hidden box --> <input type="hidden" /> Think to give names to your fields with the name attribute. |
| <textarea> | Inline |
Text input for several lines. |
| <select> | Inline> |
Scrolling list. Code : HTML
<select name="country">
<option value="england">England</option>
<option value="usa">U.S.A.</option>
<option value="italy">Italy</option>
</select>
|
| <option> | Block | Element of a scrolling list. |
| <optgroup> | Block |
Group of elements in a scrolling list. |
Generic Tags
Generic tags are tags that don’t do anything before you adapt them to your own use.
In effect, all the other tags do something : <p> is a paragraph, <h1> is an important title etc.
However, sometimes you need generic tags (also called universal tags) because no other tag does what you want. They are mainly used for making web page designs.
There are 2 generic tags : one is inline, the other is a block.
| Tag | Type | Description |
|---|---|---|
| <span> | Inline | Generic tag of inline type |
| <div> | Block | Generic tag of block type |
These tags will only do something if you give them the id, class or style attribute :
- class : indicates the name of the CSS class to use.
- id : gives a name to the tag. Its name has to be unique on the whole page as it identifies the tag. You can use id for many things, like a link to an anchor link for example, for a CSS style for ids, for manipulations in Javascript etc.
- style : this attribute allows you to insert CSS straight into the tag. Therefore you don’t need an external style sheet. However it is better not to use this attribute because using an external style sheet makes it a lot easier to change your design.
These 3 attributes aren’t reserved for generic tags : you can use them on most tags without any problems
As I said earlier in the chapter, there are several tags that I’ve left out on purpose.
As you’ll have notices, everything has its place in XHTML. The main thing is to use the right tag at the right moment.
Theoretically, you could make most of a site just with generic tags (<div> and <span>) by using CSS with them, but your site wouldn’t make any sense ! Respecting the logic of a web page is indispensable for webmasters. Using the correct tags will get you much better results on search engines such as Google.
Remember that !
Leave a Reply