May 02, 2021 HTML
4. The most important difference from HTML:
6. XHTML elements must be reasonably nested
7. XHTML elements must have a close label
8. The empty element must contain a close label
9. XHTML elements must be small case
10.. The property name must be small
11.. Property values must be quoted
12.. Property shorting is not allowed
XHTML is HTML written in XML format.
XHTML refers to an extensable hyper-text tag language
XHTML is almost identical to HTML 4.01
XHTML is a stricter and purer version of HTML
XHTML is HTML defined as an XML app
XHTML is the W3C recommendation standard released in January 2001
XHTML is case sensitive, and standard XHTML tags should use small case.
XHTML is supported by all major browsers
Many pages on the Internet contain "bad" HTML.
If viewed in a browser, the following HTML code works fine (even if it does not follow HTML rules):
<html>
<head>
<title>This is bad HTML</title>
<body>
<h1>Bad HTML
<p>This is a paragraph
</body>
XML is a well-formed markup language that must be properly marked.
If you want to learn XML, read our XML tutorial.
There are some different browser technologies in today's tech world. S ome of them run on your computer, while others may run on mobile phones or other small devices. Small devices often lack the resources and ability to interpret "bad" markup language.
So - XHTML was developed by combining the strengths of XML and HTML. XHTML is HTML that has been redesigned as XML.
XHTML DOCTYPE is mandatory
The XML namespace property in slt;html is mandatory
It is also mandatory
XHTML elements must be nested correctly
XHTML elements must always be turned off
XHTML elements must be in small case
The XHTML document must have a root element
XHTML properties must use small case
XHTML property values must be surrounded by quotation marks
Minimization of XHTML properties is also prohibited
XHTML documents must be declared as XHTML document types (XHTML DOCTYPE declaration).
You can find the full XHTML documentation type in W3Cschool's label reference manual.
The elements must also exist, and the xmlns property in the document must also exist, and the xmlns property in the .lt;html>, and the xmlns property in the document must also exist.
The following example shows an XHTML document with the fewest required labels:
<!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>
<title>Title of document</title>
</head>
<body>
......
</body>
</html>
In HTML, some elements can not nest with each other, like this:
<b><i>This text is bold and italic</b></i>
In XHTML, all elements must be reasonably nested with each other, like this:
<b><i>This text is bold and italic</i></b>
Example of an error:
<p>This is a paragraph
<p>This is another paragraph
The correct example:
<p>This is a paragraph</p>
<p>This is another paragraph</p>
Example of an error:
A break: <br>
A horizontal rule: <hr>
An image: <img src="happy.gif" alt="Happy face">
The correct example:
A break: <br />
A horizontal rule: <hr />
An image: <img src="happy.gif" alt="Happy face" />
Example of an error:
<BODY>
<P>This is a paragraph</P>
</BODY>
The correct example:
<body>
<p>This is a paragraph</p>
</body>
Example of an error:
<table WIDTH="100%">
The correct example:
<table width="100%">
Example of an error:
<table width=100%>
The correct example:
<table width="100%">
Example of an error:
<input checked>
<input readonly>
<input disabled>
<option selected>
The correct example:
<input checked="checked">
<input readonly="readonly">
<input disabled="disabled">
<option selected="selected">
Add an XHTML slt;! DOCTYPE; go to your web page
Add the xmlns property to the html element of each page.
Change all elements to small case
Close all empty elements
Modify all property names to be small
All property values are quoted