Screen Printing

TUTORIALS » HTML / JavaScript » HTML essentials (guided tutorials)

XHTML vs HTML

Page 6 of 6


Common XHTML errors

Some 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 &amp; Trucks</p>


Failing to recognize that XHTML elements and attributes are case sensitive
  Incorrect:
<B>Hello World</B>

  Correct:
<b>Hello World</b>

More pages of this tutorial → XHTML vs HTML  <123456

Comments & Questions