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
Post a comment

Fri, Apr 3 '09
by mrflowers
Keep'em coming man!
Fri, Mar 27 '09
by pocket_forza
i want more tutorials like this :D
Fri, Mar 27 '09
Avatar
by 2fast 2furious
yeah! very well explained! THANK YOU VERY MUCH!
Fri, Mar 27 '09
Avatar
by hendrix21
NOW I GET IT
Fri, Mar 27 '09
Avatar
by ebodius
Comments or Questions? You can post them here!

Post a comment