XHTML - Elementer
- Previous page XHTML Introduktion
- Next page XHTML attributes
XHTML elements are HTML elements written in XML format.
XHTML element - Syntax rules
- XHTML elements mustcorrectly nested
- XHTML elements must alwaysclosed
- 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 wrong:
<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 wrong:
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 wrong:
<BODY> <P>This is a paragraph</P> </BODY>
This is correct:
<body> <p>This is a paragraph</p> </body>
- Previous page XHTML Introduktion
- Next page XHTML attributes