Basic declaration document type description (DTD) for web page making

Time:2021-11-28

CSS layout to create web pages that conform to web standards has always been a topic discussed by jb51.net. Today, let’s talk about declaration document type description (DTD).
All files need to start with a document type definition (DTD) to tell the browser what rules to follow when opening a page.  
When we use the web design tool Dreamweaver   After creating a new web document, you will see the DOCTYPE Declaration 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 a document type definition (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, only for identification, and then decide what specifications to use to execute the code in the page.
  ”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.”

We use four common document types to create our website  
 

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01//EN” “http://www.w3.org/TR/html4/strict.dtd”> 
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”> 
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”> 
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”> 

Among the four document types:
 
HTML 4.01 provides two common DTDs  :
(1). Strict: for DTDs with strict requirements, users must use labels that comply with the definitions in html4.01.
(2). Loose line: it requires a relatively loose DTD, which is compatible with other previous HTML versions.
XHTML 1.0 provides two common DTDs  :
(1). Transitional: a very loose DTD is required. It allows users to continue to use html4.01 tags, but it should conform to the writing method of XHTML.
(2). Strict

DTD represents the definition of document type. They define what can and cannot be in a specific version of XML, XHTML and HTML. When loading a web page, the browser will use the established declaration specification to check whether the content of the page is valid, and then take corresponding measures and codes to interpret the code in the document.  
We don’t need to delve into how they work, just know that they can ensure that we can develop standard web pages and ensure the correct rendering of CSS.
In general, I suggest readers choose the transitional document type. This DTD is relatively loose and easy to pass the W3C code verification. It 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! But Adobe   Dreamweaver   The default in CS3 / CS4 tools is strict.