TUTORIALS » HTML / JavaScript » HTML essentials (guided tutorials)XHTML vs HTMLPage 6 of 6You are in page:» 6. Common XHTML errors Common XHTML errorsSome of the most common errors in the usage of XHTML are:Not closing empty elements Incorrect: <br> Correct: <br /> Not closing non-empty elements Incorrect: <p>Hello World<p>How are you? Correct: <p>Hello World</p> <p>How are you?</p> Improperly nesting elements (in the wrong order) Incorrect: <i><b>Hello World</i></b> Correct: <i><b>Hello World</b></i> Not putting quotation marks around attribute values Incorrect: <img src=myimage.jpg width=200 height=300 /> Correct: <img src="myimage.jpg" width="200" height="300" /> Using the ampersand character outside of entities Incorrect: <p>Cars & Trucks</p> Correct: <p>Cars & Trucks</p> Failing to recognize that XHTML elements and attributes are case sensitive Incorrect: <B>Hello World</B> Correct: <b>Hello World</b>
|
|