what is html dtd
In HTML, DTD refers to "Document Type Definition", which is a set of grammatical rules about tags, a verification mechanism for HTML files, and is part of the composition of HTML files. DTD can define legal XML document building blocks, which uses a series of legal elements to define the structure of the document.
The operating environment of this tutorial: Windows 7 system, HTML5 version, Dell G3 computer.
Document Type Definition (DTD) is a set of syntax rules for tags. It is part of the XML1.0 version specification, is the verification mechanism of html files, and is part of the composition of html files.
DTD can define legal XML document building blocks. It uses a series of legal elements to define the structure of the document.
DTD can be declared in an XML document as a line or as an external reference.
Internal DOCTYPE declaration
If the DTD is included in your XML source file, it should be wrapped in a DOCTYPE declaration using the following syntax:
<!DOCTYPE root-element [element-declarations]>
Example of XML document with DTD (please open in IE5 and higher, and choose to view source code):
<?xml version="1.0"?> <!DOCTYPE note [ <!ELEMENT note (to,from,heading,body)> <!ELEMENT to (#PCDATA)> <!ELEMENT from (#PCDATA)> <!ELEMENT heading (#PCDATA)> <!ELEMENT body (#PCDATA)> ]> <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend</body> </note>
Open this XML file in your browser, and choose " View source code" command.
The above DTD is explained as follows:
!DOCTYPE note (second line) defines this document as a note type document.
!ELEMENT note (third line) defines the note element as having four elements: "to, from, heading,, body"
!ELEMENT to (the fourth line) defines the to element as "#PCDATA" type
!ELEMENT from (the fifth line) defines the from element as "#PCDATA" type
!ELEMENT heading (line 6) defines the heading element as "#PCDATA" type
!ELEMENT body (line 7) defines the body element as "# PCDATA" type
External Document Declaration
If the DTD is located outside the XML source file, then it should be encapsulated in a DOCTYPE definition:
<!DOCTYPE root-element SYSTEM "filename">
This XML document is the same as the above XML document, but has an external DTD: (Click to open the file and select the "View Source Code" command.)
<?xml version="1.0"?> <!DOCTYPE note SYSTEM "note.dtd"> <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note>
This is the "note.dtd" file containing the DTD:
<!ELEMENT note (to,from,heading,body)> <!ELEMENT to (#PCDATA)> <!ELEMENT from (#PCDATA)> <!ELEMENT heading (#PCDATA)> <!ELEMENT body (#PCDATA)>
Why use DTD?
With a DTD, each of your XML files can carry a description of its own format.
With DTD, independent groups can consistently use a standard DTD to exchange data.
Your application can also use a standard DTD to verify data received from the outside.
You can also use DTDs to validate your own data.
DTD has three document types: S (Strict), T (Transitional), and F (Frameset).
#Strict: Use this type if you need clean markup without clutter in the presentation layer. Please use with Cascading Style Sheets (CSS)
Transitional: DTD can contain rendering attributes and elements that the W3C expects to be moved into the style sheet. If your readers are using browsers that do not support Cascading Style Sheets (CSS) and you have to use HTML's rendering features use
#Frameset: DTD should be used with Framework documentation. Except that the frameset element replaces the body element, the Frameset DTD is equivalent to the Transitional DTD
html5 basically does not have the strict requirements of XHTML 1.0 Transitional, and has simplified many things and can be used directly <!DOCTYPE HTML>
Recommended tutorial: "html video tutorial"
The above is the detailed content of what is html dtd. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Guide to Table Border in HTML. Here we discuss multiple ways for defining table-border with examples of the Table Border in HTML.

Guide to HTML margin-left. Here we discuss a brief overview on HTML margin-left and its Examples along with its Code Implementation.

This is a guide to Nested Table in HTML. Here we discuss how to create a table within the table along with the respective examples.

Guide to HTML Table Layout. Here we discuss the Values of HTML Table Layout along with the examples and outputs n detail.

Guide to HTML Input Placeholder. Here we discuss the Examples of HTML Input Placeholder along with the codes and outputs.

Guide to the HTML Ordered List. Here we also discuss introduction of HTML Ordered list and types along with their example respectively

Guide to Moving Text in HTML. Here we discuss an introduction, how marquee tag work with syntax and examples to implement.

Guide to HTML onclick Button. Here we discuss their introduction, working, examples and onclick Event in various events respectively.
