Web page creation basic declaration document type description (DTD

Web page creation basic declaration document type description (DTD
Using CSS layout to create web pages that comply with WEB standards has always been a topic discussed by jb51.net. Today we will talk about declaring a 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 the page.
When we use the web design tool Dreamweaver to create a new web document, you will see the DOCTYPE declaration in 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 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 4 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">

There are 4 document types:

HTML4.01 provides two commonly used DTDs:
(1) Strict: Requires strict DTD, and users must use tags that comply with the definitions in HTML4.01.
(2) Loose lines: require a looser DTD, 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. It allows users to continue to use HTML4.01 tags, but must comply with XHTML writing.
(2) Strict


DTD stands for Document Type Definition. 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 specifications to check whether the content of the page is valid, and then take appropriate measures and code to interpret the code in the document.
We don't need to delve into how they work, we just need to know that they can ensure that we develop standard web pages and ensure the correct rendering of CSS.
In general, I recommend that readers choose a transitional document type. This type of DTD is more relaxed and easier to pass W3C code verification. It is more suitable for the current domestic development environment and the level of most developers.
We also need to develop towards a strict level! However, the default setting in Adobe Dreamweaver CS3/CS4 tools is strict.

<<:  Solve the problem that some configuration files in /etc are reset after the docker container is restarted

>>:  jQuery canvas draws picture verification code example

Recommend

How to embed other web pages in a web page using iframe

How to use iframe: Copy code The code is as follo...

How to use cookies to remember passwords for 7 days on the vue login page

Problem Description In the login page of the proj...

CSS code to achieve background gradient and automatic full screen

CSS issues about background gradient and automati...

Solution to MySQL restarting automatically

Preface Recently, a problem occurred in the test ...

JavaScript implements draggable modal box

This article shares the specific code of JavaScri...

Detailed installation instructions for the cloud server pagoda panel

Table of contents 0x01. Install the Pagoda Panel ...

Detailed explanation of Vue3 sandbox mechanism

Table of contents Preface Browser compiled versio...

A brief discussion on JS packaging objects

Table of contents Overview definition Instance Me...

Navicat for MySQL 15 Registration and Activation Detailed Tutorial

1. Download Navicat for MySQL 15 https://www.navi...

Details of the order in which MySQL reads my.cnf

Table of contents The order in which MySQL reads ...

Solve the problem of HTML automatic formatting after saving in vscode

The version of vsCode has been updated in recent ...

Detailed implementation plan of Vue front-end exporting Excel files

Table of contents 1. Technology Selection 2. Tech...