Summary of using DTD in HTML

Time:2021-6-13

DTD is a set of syntax rules about markers. It is a part of XML 1.0 specification, a verification mechanism of HTML file, and a part of HTML file.

DTD: three document types: s (strict), t (transitional), f (frameset).
Strict: use this type if you need clean markup to avoid presentation layer clutter. Use with cascading style sheets (CSS)
Transitional: DTDs can contain rendering attributes and elements that W3C expects to move into the stylesheet. If your readers use browsers that don’t support cascading style sheets (CSS) so that you have to use the rendering features of HTML
Frameset: DTDs should be used for documents with frames. Except that frameset element replaces body element, frameset DTD is equivalent to transitional DTD

HTML5 basically does not have the strict requirements of XHTML 1.0 transition, and simplifies a lot of things. You can directly use <! DOCTYPE HTML>

HTML5
<!DOCTYPE HTML>
——————————————————————————————
xhtml 1.1:
<!doctype html public “-/w3c/dtd xhtml 1.1/en” “http://www.w3.org/tr/xhtml11/dtd/xhtml11.dtd”>
xhtml 1.1 plus mathml plus svg:
<!doctype html public “-/w3c/dtd xhtml 1.1 plus mathml 2.0 plus svg 1.1/en” “http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd”>
——————————————————————————————
html 4.01 strict:
<!doctype html public “-/w3c/dtd html 4.01/en” “http://www.w3.org/tr/html4/strict.dtd”>
html 4.01 transitional:
<!doctype html public “-/w3c/dtd html 4.01 transitional/en” “http://www.w3.org/tr/html4/loose.dtd”>
html 4.01 frameset:
<!doctype html public “-/w3c/dtd html 4.01 frameset/en” “http://www.w3.org/tr/html4/frameset.dtd”>
——————————————————————————————
xhtml 1.0 strict:
<!doctype html public “-/w3c/dtd xhtml 1.0 strict/en” “http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd”>
xhtml 1.0 transitional:
<!doctype html public “-/w3c/dtd xhtml 1.0 transitional/en” “http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd”>
xhtml 1.0 frameset:
<!doctype html public “-/w3c/dtd xhtml 1.0 frameset/en” “http://www.w3.org/tr/xhtml1/dtd/xhtml1-frameset.dtd”>
——————————————————————————————
html 3.2:
<!doctype html public “-/w3c/dtd html 3.2 final/en”>
——————————————————————————————
HTML 2 (number 2 stands for version number)
<!doctype html public “-/ietf/dtd html 2.0/en”>

Attach an old version label to the DTD document:

label

describe

DTD

<!DOCTYPE> 

Define the document type.

STF

<html>

Define HTML documents.

STF

<body>

Defines the body of the document.

STF

<h1> to <h6>

Define the HTML title.

STF

<p>

Define the paragraph.

STF

<br>

Define simple line breaks.

STF

<hr>

Define the horizontal line.

STF

<!–…–>

Define comments.

STF

 

label

describe

DTD

<b>

Define bold text.

STF

<font>

They are not in favor of using. Defines the font, size, and color of the text

TF

<i>

Defines italicized text.

STF

<em>

Definition emphasizes text.

STF

<big>

Defines large text.

STF

<strong>

It defines the text with stronger emphasis.

STF

<small>

Defines small text.

STF

<sup>

Defines superscript text.

STF

<sub>

Defines subscript text.

STF

<bdo>

Defines the direction of the text.

STF

<u>

They are not in favor of using. Defines the underlined text.

TF

 

label

describe

DTD

<pre>

Define pre formatted text

STF

<code>

Define the computer code text.

STF

<tt>

Defines typewriter text.

STF

<kbd>

Define keyboard text.

STF

<var>

Defines the variable part of the text.

STF

<dfn>

Define the project.

STF

<samp>

Define computer code samples.

STF

<xmp>

They are not in favor of using. Define pre formatted text.

 

label

describe

DTD

<acronym>

Define acronyms.

STF

<abbr>

Define abbreviations.

STF

<address>

Define the contact information of the author or owner of the document.

STF

<blockquote>

Defines the block reference.

STF

<center>

They are not in favor of using. Defines centered text.

TF

<q>

Define short references.

STF

<cite>

Define a reference.

STF

<ins>

The definition is inserted into the text.

STF

<del>

Defines the deleted text.

STF

<s>

They are not in favor of using. Defines the text with a strikeout.

TF

<strike>

They are not in favor of using. Defines the text with a strikeout.

TF

 

label

describe

DTD

<a>

Define the anchor.

STF

<link>

Define the relationship between documents and external resources.

STF

 

label

describe

DTD

<frame>

The window or frame that defines the frameset.

F

<frameset>

Define the frameset.

F

<noframes>

Defines alternative content for users who do not support frameworks.

TF

<iframe>

Define the inline framework.

TF

 

label

describe

DTD

<form>

Define HTML forms for user input.

STF

<input>

Define input controls.

STF

<textarea>

Defines a multiline text input control.

STF

<button>

Define the button.

STF

<select>

Define a selection list (drop-down list).

STF

<optgroup>

Defines the combination of related options in the selection list.

STF

<option>

Defines the options in the selection list.

STF

<label>

Defines the annotation of the input element.

STF

<fieldset>

Defines the border around the elements in the form.

STF

<legend>

Defines the title of the fieldset element.

STF

<isindex>

They are not in favor of using. Defines the searchable index associated with the document.

TF

 

label

describe

DTD

<ul>

Defines an unordered list.

STF

<ol>

There is a sequence table defined.

STF

<li>

Defines the items in the list.

STF

<dir>

They are not in favor of using. Define the list of directories.

TF

<dl>

Definition list.

STF

<dt>

Define the items in the list.

STF

<dd>

Defines the description of the item in the list.

STF

<menu>

They are not in favor of using. Define the menu list.

TF

 

label

describe

DTD

<img>

Define the image.

STF

<map>

Define image mapping.

STF

<area>

Define the area inside the image map.

STF

 

label

describe

DTD

<table>

Define table

STF

<caption>

Define the table title.

STF

<th>

Defines the header cells in a table.

STF

<tr>

Define the rows in the table.

STF

<td>

Define the cells in the table.

STF

<thead>

Defines the contents of the header in the table.

STF

<tbody>

Defines the body content in the table.

STF

<tfoot>

Define the table notes (footnotes) in the table.

STF

<col>

Defines the property values of one or more columns in a table.

STF

<colgroup>

Defines the column groups in a table for formatting.

STF

 

label

describe

DTD

<style>

Defines the style information for the document.

STF

<div>

Define the sections in the document.

STF

<span>

Define the sections in the document.

STF

 

label

describe

DTD

<head>

Defines information about the document.

STF

<title>

Defines the title of the document.

STF

<meta>

Defines meta information about html documents.

STF

<base>

Defines the default address or default destination for all links in the page.

STF

<basefont>

They are not in favor of using. Defines the default font, color, or size of text in a page.

TF

 

label

describe

DTD

<script>

Define the client script.

STF

<noscript>

Define alternatives for users who do not support client script.

STF

<applet>

They are not in favor of using. Define the embedded applet.

TF

<object>

Defines the embedded object.

STF

<param>

Defines the parameters of the object.

STF