|
|
|||
| web developers reference | ||||
| Home > XHTML > XHTML Tutorial | ||||
|
XHTML TutorialThis XHTML tutorial will show you how to code your pages using XHTML. If you already know HTML, this XHTML tutorial should be an absolute breeze! There are only a handful of differences between HTML and XHTML. Fortunately, they are all minor, which makes it much easier to convert your website from HTML to XHTML. Just, don't forget to declare the document. Here are the main things to remember when writing XHTML:
Must have a DOCTYPE declarationAll XHTML documents must have a DOCTYPE declaration. The document must include the usual html, head, title, and body elements. Example: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> All XHTML tags are lower caseWrong <A HREF="xhtml/xhtml_tutorial.html"> Right <a href="xhtml/xhtml_tutorial.html"> XHTML Tutorial</a> Close all tags (even empty elements)Wrong <img src="pix/xhtml_tutorial.gif"> Right <img src="pix/xhtml_tutorial.gif" /> Attribute values must be quotedWrong <img src="pix/xhtml_tutorial.gif" width=250 height=50 border=0 /> Right <img src="pix/xhtml_tutorial.gif" width="250" height="50" border="0" /> Minimization is forbiddenWrong <option selected> Right <option selected="selected"> The id attribute replaces the name attributeWrong <img src="pix/xhtml_tutorial.gif" name="xhtml_tutorial"> Right <img src="pix/xhtml_tutorial.gif" id="xhtml_tutorial"> The script element must have a type definitionWrong <script language="javascript" type="text/javascript" > document.write("XHTML Tutorial from <b>HELL!</b>"); </script> Right <script> <![CDATA[ document.write("XHTML Tutorial from <b>HELL!</b>"); ]]> </script> Documents must conform to XML rulesNo improper nesting etc Wrong <b><i> This text is bold and italic</b> </i> Right <b><i> This text is bold and italic</i></b> XHTML books you might like: |
|
About Quackit | Terms of use | Contact Quackit
© Copyright 2000 - 2003 Quackit.com