Understand XHTML and create simple XHTML file.
Understand XHTML and create simple XHTML file.XHTML (eXtensible HyperText Markup Language) is extended, stricter and cleaner version of HTML 4 and is designed to work with XML.
Rules for creating XHTML document
In html, if you omit an end-tag or leave a quote etc, the page still displays its content and nothing too serious happens with the page. But as XHTML is a combination of html and xml, writing code is much harder and stricter than html but it makes the code cleaner and more self explanatory. XHTML document should follow some rules as given below:
Valid XHTML documents:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<?xml version="1.0" encoding="UTF-8"?>
Why XHTML
Sample XHTML document:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title> Sample XHTML</title>
</head>
<body>
<p>Sample XHTML</p>
</body>
</html>