XHTML
XHTML
```xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML
1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-
strict.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8" />
<title>XHTML Example</title>
</head>
<body>
<h1>Welcome to XHTML</h1>
<p>This is a simple XHTML document.</p>
<img src="example.jpg" alt="Example Image"
/>
</body>
</html>
```
### XHTML vs. HTML:
- **Strictness**: XHTML enforces a stricter
syntax than HTML. For example, in XHTML, you
must close all tags and use lowercase for tags
and attributes.
- **Compatibility**: HTML is more lenient and
can be parsed by browsers even with missing or
incorrectly nested tags, whereas XHTML
requires that the document be perfectly
structured to avoid errors.
- **XML-based**: XHTML is based on XML, so it
is more extensible and can be used with other
XML tools and technologies, such as XSLT
(Extensible Stylesheet Language
Transformations).
### Usage:
While XHTML was popular for a period
(especially in the early 2000s), it has largely
been superseded by HTML5. HTML5 is more
flexible and backward-compatible with older
versions of HTML, making it the preferred
choice for most modern web development.