CSS layout to create pages that comply with WEB standards has always been a topic discussed by jb51.net. Today we will talk about Declaration Document Type Description (DTD).
All files need to start with a document type definition (DTD) to tell the browser what rules it should follow 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 the abbreviation of document type, which defines the basic type of the current document. That is, all files need to use a document type definition (DTD).
In fact, DOCTYPE is just a set of machine-readable specifications. Although it contains the URL of the file, the browser will not read these files. It is only used for identification, and then decides what specifications to use to execute the page. code.
"The DOCTYPE goes before the opening html tag at the top of the page and tells the browser whether the page contains HTML, XHTML, or a mix of both, so that it can correctly interpret the markup."
4 commonly used document types to create our website
Among the 4 document types:
HTML4.01 provides two commonly used DTDs:
(1). Strict type (strict): DTD with strict requirements, users must use HTML4 Tags defined in .01.
(2). Loose: A relatively loose DTD is required, which is more compatible with other previous versions of HTML.
XHTML1.0 provides two commonly used DTDs:
(1). Transitional: a DTD with very loose requirements, which allows users to continue to use HTML4.01 tags, but must comply with the writing method of XHTML .
(2). Strict
DTD represents the definition of document type. They define what can and cannot be included in a specific version of XML, XHTML and HTML. When loading a web page, the browser will use the established declaration specification to check The content of the page is valid, and then appropriate action is taken to interpret the code in the document with encoding.
We don’t need to delve into how they work, as long as we know that they can ensure that we develop standard web pages and ensure the correct rendering of CSS.
Under normal circumstances, I recommend readers to choose a transitional document type. This type of DTD is relatively loose and easier to pass W3C code verification. It is more suitable for the current domestic development environment and the level of most developers.
When we also have to develop to a strict level! However, the default in Adobe Dreamweaver CS3/CS4 tools is strict.