ASWCode Tutorials

Learn Web Development - From Basics to Advanced

HTML vs XHTML

HTML and XHTML are both used to build webpages, but they follow different rules. Here’s a simple comparison to understand both easily.

1. HTML

2. XHTML

3. Simple Example

HTML version:

<p>Hello World</p>
<br>
<img src="logo.png">

XHTML version:

<p>Hello World</p>
<br />
<img src="logo.png" />

4. Key Differences

Feature HTML XHTML
Case Sensitivity Not case-sensitive Case-sensitive (lowercase required)
Closing Tags Some tags can stay open All tags must be closed
Strictness Flexible Very strict
Error Handling Browser auto-corrects Errors break layout

Next Lesson → HTML File Naming

Previous Lesson → HTML Encoding (Character Sets)

← Back