Home

HTML vs XHTML


Case Sensitivity

In HTML case does not matter for tag names and attribute names

<BODY>, <Body>, and <body> are equivalent.
<H1 ALIGN="..."> is equivalent to <H1 aLiGn="...">

In xhtml, tag names and attribute names must be in lower case

<body>, <h1 align="...">

HTML - XHTML - Quotes

In HTML quotes are optional if attribute value contains only alphanumeric values

  • <H1 ALIGN="LEFT"> or <H1 ALIGN=LEFT>

In xhtml, you must always use single or double quotes

  • <h1 align="left"> or <h1 align='left'>

HTML - XHTML Tags Handling

In HTML some tags are containers

  • <H1>...</H1>, <A HREF...>...</A>

In HTML some tags are standalone

  • <BR>, <HR>

In HTML Some tags have optional end tags

  • <P>, <LI>, <TR>, <TD>, <TH>

In XHTML All tags are containers. End tags always required.

  • <p>...</p>, <li>...</li>

In XHTML if there is no body content, start/end tags can be merged

  • <br></br> or just <br/>