XHTML three file type declarations

Time:2022-5-7

XHTML defines three file type declarations.

The most commonly used is XHTML transitional.<! DOCTYPE > is mandatory.
An XHTML document has three main parts:
The basic document structure is as follows:
<!DOCTYPE …><html><head><title>… </title></head><body> … </body></html>

In XHTML documents, the document type declaration is always on the first line.
This is a simple (minimized) XHTML document:
<!DOCTYPE htmlPUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN””http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”><html><head><title>simple document</title></head><body><p>a simple paragraph</p></body></html>

The document type declaration defines the type of document:
<!DOCTYPE htmlPUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN””http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>

The rest of the document looks like HTML:
<html><head><title>simple document</title></head><body><p>a simple paragraph</p></body></html>
XHTML 1.0 specifies three XML document types to correspond to the above three DTDs.

XHTML 1.0 Strict

<!DOCTYPE htmlPUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd“>

Use in this case: clean marks are required to avoid confusion in performance. Use with cascading style sheets.
<!DOCTYPE htmlPUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN””http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd“>

Use in this case: when you need to take advantage of the expressive features of HTML, and when you need to write XHTML for browsers that do not support cascading style sheets.
<!DOCTYPE htmlPUBLIC “-//W3C//DTD XHTML 1.0 Frameset//EN””http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">

Use when you need to use HTML frames to split the browser window into two or more frames.