XHTML Reference
General Formatting
Commenting your source
Comments can be placed anywhere within an HTML document except within the other tags used to markup the document. All comments begin with <!-- and end with -->. The XHTML specification states that the content of comment fields should be ignored so the practice of enclosing script and style statements within comments no longer works with browsers that comply with the XHTML standard.
Paragraphs
The basic unit of text within a document is the paragraph. Each paragraph within the document should be contained between the following tags <p> </p>. Note that the XHTML standard requires all end tags to be specified.
The following optional attributes can be specified on a <p> tag:
The following attributes are deprecated but can still be used with the transitional DOCTYPE
- align
.use with left, center, right.
Headings
There are six different heading levels that can be used to place headings within your document. The heading should be placed between the appropriate pair of tags from the following:
- <h1> </h1>
Example
- <h2> </h2>
Example
- <h3> </h3>
Example
- <h4> </h4>
Example
- <h5> </h5>
Example
- <h6> </h6>
Example
The following optional attributes can be specified on a heading tag:
The following attributes are deprecated but can still be used with the transitional DOCTYPE
- align
.use with left, center, right.
Other section breaks
The following two pairs of tags allow you to split your document up into sections which can be formatted and manipulated differently from the other sections of your document.
- <div> </div>
- <span> </span>
The following optional attributes can be specified on <div> and <span> tags:
Physical Styles
These styles are always rendered the same way provided that the browser that is being used supports them. If a browser does not support rendering in that way then the tags will be ignored.
- <b> </b>
These tags displays the enclosed text in bold. - <i> </i>,
These tags displays the enclosed text in italics. - <tt> </tt>
These tags displays the enclosed text in a monospace font. - <sub> </sub>
These tags display the enclosed text as a subscript. - <sup> </sup>
These tags display the enclosed text as a superscript.
The following optional attributes can be specified on physical style tags:
Logical Styles
These styles can be rendered in different ways by different browsers. These tags are more descriptive of the type of item contained within the tags rather than the way that you want it displayed. Some of these are relatively new and may not be recognised by some browsers. You can see how the various tags display on your browser below.
- <em> </em>
The text enclosed within these tags appears emphasized on your browser. - <strong> </strong>
The text enclosed within these tags appears strongly emphasized on your browser. - <abbr> </abbr>
The text enclosed within these tags appears as an abbreviation on your browser. - <acronym> </acronym>
The text enclosed within these tags appears as an acronym on your browser. - <address> </address>
The text enclosed within these tags appears as an address on your browser. - <cite> </cite>
The text enclosed within these tags appears as a citation on your browser. - <code> </code>
The text enclosed within these tags appearsas code - <dfn> </dfn>
The text enclosed within these tags appears as a definition - <kbd> </kbd>
The text enclosed within these tags appears as keyboard input on your browser. - <samp> </samp>
The text enclosed within these tags appears as sample text on your browser. - <var> </var>
The text enclosed within these tags appears as a variable on your browser.
The following optional attributes can be specified on logical style tags:
Size
You can modify the size of the text being displayed using the following pairs of tags.
- <big> </big> which makes the text bigger and
- <small> </small> which makes the text smaller
The following optional attributes can be specified on size tags:
Line Breaks
The following tags and tag pairs manipulate the position that text appears on the page.
- <br /> forces following text to a new line
like this.The following optional attributes can be specified on the <br /> tag:
The following attributes are deprecated but can still be used with the transitional DOCTYPE
- clear
use with left, right, all, none. Default is none.
- clear
- <pre> </pre>
forces the enclosed text to appear exactly as written complete with all of the spaces and line breaks.The following optional attributes can be specified on the <pre> tag:
- xml:space="preserve"
- core
- international
- event
The following attributes are deprecated but can still be used with the transitional DOCTYPE
- width
A <pre> tag may not be have an <img> tag, <object> tag, <big> tag, <small> tag, <sub> tag, or <sup> tag nested within it.
- <blockquote> </blockquote>
indents the block of text like this.
- <q> </q>
also indents the text on browsers that understand it.
The following optional attributes can be specified on <blockquote> and <q> tags:
- <hr /> inserts a horizontal line.
The following optional attributes can be specified on an <hr> tag:
The following attributes are deprecated but can still be used with the transitional DOCTYPE
- align
.use with left, center, right. - noshade
- size
- width
- align
New or Removed
You can indicate new or removed text on your page using the following tags.
- <del> </del> marks
deletedtext. - <ins> </ins> marks inserted text.
The following optional attributes can be specified on an <ins> or <del> tag:
- cite
- datetime
- core
- international
- event
Other format types
The <bdo dir=""> </bdo> tags surround text in foreign languages so that the direction of the text can be indicated to the browser. Direction can be LTR (left to right) or RTL (right to left).
The following optional attributes can be specified on the <bdo> tag:


