CSS layout and establishing pages that comply with WEB standards have always been a topic of discussion among VeVb.com. Today, we will talk about the declaration document type description (DTD).
All files need to be started with Document Type Definition (DTD) to tell the browser what rules should be followed when opening the page.
When we use the web design tool Dreamweaver to create a new web document, you will see the DOCTYPE statement on the first line of the new document.
DOCTYPE is abbreviation for document types, which defines the basic type of the current document. That is, all files need to be defined with document type (DTD).
In fact, DOCTYPE is just a set of machine-readable specifications. Although the URL of the file is included in the middle, the browser will not read these files. It is only used for identification and then decides what specifications to execute the code in the page.
The DOCTY PEgoes before the opening html tagat thetop for the page and tells the browser whether the page contains HTML, XHTML, oramixofboth, sothatit can correctly interpret the markup.
We use 4 common document types to create our website
<!DOCTYPEHTMLPUBLIC-//W3C//DTDHTML4.01//ENhttp://www.w3.org/TR/html4/strict.dtd>
<!DOCTYPEHTMLPUBLIC-//W3C//DTDHTML4.01Transitional//ENhttp://www.w3.org/TR/html4/loose.dtd>
<!DOCTYPEhtmlPUBLIC-//W3C//DTDXHTML1.0Transitional//ENhttp://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd>
<!DOCTYPEhtmlPUBLIC-//W3C//DTDXHTML1.0Strict//ENhttp://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd>
Among 4 document types:
HTML4.01 provides two commonly used DTDs:
(1). Strict type: strict DTD, users must use tags that comply with HTML4.01.
(2). Loose: DTD that requires relatively looseness is more compatible with other versions of previous HTML.
XHTML1.0 provides two commonly used DTDs:
(1). Transitional: A very loose DTD is required, which allows users to continue to use HTML4.01 tags, but must comply with the XHTML writing method.
(2). Strict type (strict)
DTD represents the definition of document types. They define what can be or cannot be found in a specific version of XML, XHTML and HTML. When loading a web page, the browser will use established declaration specifications to check whether the content of the page is valid, and then take corresponding measures and encoding to interpret the code in the document.
We don't need to dig deep into how they work, just know that they can ensure that we develop standard web pages and ensure that CSS is rendered correctly.
Generally speaking, I suggest that readers choose transitional document types. This kind of DTD is relatively loose and is easier to pass W3C code verification, which is more suitable for the current domestic development environment and the level of most developers.
When we also want to develop to the strict level! However, the default is strict in Adobe DreamweaverCS3/CS4 tools.