<!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd>
In the above declaration, the root element of the document is declared as html, which is defined in DTD with the public identifier defined as -//W3C//DTD XHTML 1.0 Strict//EN. The browser will understand how to find a DTD that matches this public identifier. If not found, the browser will use the URL after the public identifier as the location to look for the DTD.
HTML 4.01 and XHTML1.0 specify three document types: Strict, Transitional, and Frameset.
1.HTML Strict DTD
If you need clean markings to avoid confusion in presentation layers, use this type. Please use it with Cascading Style Sheets (CSS):
<!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01//EN http://www.w3.org/TR/html4/strict.dtd>
2.HTML Transitional DTD
Transitional DTD can contain rendering properties and elements that W3C expects to move into the style sheet. Use this type if your readers use browsers that do not support cascading stylesheets (CSS) so that you have to use the rendering feature of HTML:
<!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd>
3.Frameset DTD
Frameset DTD should be used for documents with frames. Except for the frameset element that replaces the body element, Frameset DTD is equivalent to Transitional DTD:
<!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Frameset//EN http://www.w3.org/TR/html4/frameset.dtd>
Searching the information says that you don’t need to write the full text when writing <!DOCTYPE>, that is, just declare <!DOCTYPE html>, and there is no need to define dtd, because only if you do not declare <!DOCTYPE>, the weird mode will be turned on, instead of not declaring dtd will be turned on, that is, you only need to define <!doctype html> to allow the browser to render the page in strict mode (standard mode) without specifying a certain type of dtd. And it is backward compatible, this is how html5's <!DOCTYPE> is written, and modern browsers recognize it.
Learn more:
All browsers require two modes: weird mode and strict mode (some people call standard mode). IE 6 for Windows/mac, Mozilla, Safari and Opera all implement these two modes, but IE 6 versions below are always set in weird mode. You can use mode=document.compatMode; to determine whether the browser is in weird mode or standard mode.
1. Pages written before standardization doctype, so pages without doctype are rendered in weird mode.
2. Most browsers' doctype will turn on strict mode (standard mode), and the page will also be rendered according to the standards.
3. Any new or unknown doctype will turn on strict mode (standard mode).
4. Each browser has its own way to activate weird mode.