XHTML - Elements
- Previous Page XHTML Introduction
- Next Page XHTML Attributes
XHTML elements are HTML elements written in XML format.
XHTML Element - Syntax Rules
- XHTML elements mustbe correctly nested
- XHTML elements must alwaysbe closed
- XHTML elements mustlowercase
- An XHTML document must haveA root element
XHTML elements must be correctly nested
In HTML, some elements can be incorrectly nested with each other, like this:
<b><i>This text is bold and italic</b></i>
In XHTML, all elements must be correctly nested with each other, like this:
<b><i>This text is bold and italic</i></b>
XHTML elements must always be closed
This is incorrect:
<p>This is a paragraph <p>This is another paragraph
This is correct:
<p>This is a paragraph</p> <p>This is another paragraph</p>
Empty elements must also be closed
This is incorrect:
A break: <br> A horizontal rule: <hr> An image: <img src="happy.gif" alt="Happy face">
This is correct:
A break: <br /> A horizontal rule: <hr /> An image: <img src="happy.gif" alt="Happy face" />
XHTML elements must be lowercase
This is incorrect:
<BODY> <P>This is a paragraph</P> </BODY>
This is correct:
<body> <p>This is a paragraph</p> </body>
- Previous Page XHTML Introduction
- Next Page XHTML Attributes