Thursday, October 14, 2010

XHTML vs HTML

XHTML is not very different from the HTML 4.01 standard.So, bring your code up to 4.01 standard is a good start.

Given the fact that XHTML is an XML application, certain practices that were perfectly legal in SGML-based HTML 4 has been amended accordingly. You've already seen the XHTML syntax in the previous chapter, then the differences in XHTML and HTML are very clear:

XHTML documents must be well formed:
This means that all elements must have closing tags and all the elements must nest properly.
e.g:
<p>XHTML documents must be well formed:</p>

Attribute names must be in lower case:
XHTML documents must use lower case for all the names of HTML elements and attributes. This distinction is necessary because the document is considered XML XHTML, XML, and uppercase and lowercase letters.
e.g. <p>.....</p>  

Document is a XHTML DOCTYPE declaration at the top of the document. 
e.g: 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>XHTML</title>
</head>

<body>
</body>
</html>



  All the attribute values must be quoted.

All attribute values must be quoted, even those which appear to be numeric.
e.g:
<td rowspan="3">

No comments:

Post a Comment