Get Ready For XHTML
XHTML is not very different from the HTML 4.01 standard.So, bringing your code up to the 4.01 standard is a good start.
Our complete HTML 4.01 reference can help you with that.
In addition, you should start NOW to write your HTML code in lowercase letters, and NEVER skip closing tags (like </p>).
The Most Important Differences:
- XHTML elements must be properly nested
- XHTML elements must always be closed
- XHTML elements must be in lowercase
- XHTML documents must have one root element
XHTML Elements Must Be Properly Nested
In HTML, some elements can be improperly nested within each other, like this:| <b><i>This text is bold and italic</b></i> |
| <b><i>This text is bold and italic</i></b> |
This is wrong:
| <ul> <li>Coffee</li> <li>Tea <ul> <li>Black tea</li> <li>Green tea</li> </ul> <li>Milk</li> </ul> |
| <ul> <li>Coffee</li> <li>Tea <ul> <li>Black tea</li> <li>Green tea</li> </ul> </li> <li>Milk</li> </ul> |
XHTML Elements Must Always Be Closed
Non-empty elements must have a closing tag.This is wrong:
| <p>This is a paragraph <p>This is another paragraph |
| <p>This is a paragraph</p> <p>This is another paragraph</p> |
Empty Elements Must Also Be Closed
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"> |
| A break: <br /> A horizontal rule: <hr /> An image: <img src="happy.gif" alt="Happy face" /> |
XHTML Elements Must Be In Lower Case
Tag names and attributes must be in lower case.This is wrong:
| <BODY> <P>This is a paragraph</P> </BODY> |
| <body> <p>This is a paragraph</p> </body> |
XHTML Documents Must Have One Root Element
All XHTML elements must be nested within the <html> root element. Child elements must be in pairs and correctly nested within their parent element.The basic document structure is:
<html>
<head> ... </head>
<body> ... </body>
</html>
No comments:
Post a Comment