DTD (Document Type Definition) is an XML document that explains which tags, attributes or values are valid for a specific type of HTML. HTML follows certain rules. These rules are contained in a Document Type Definition file, or DTD as it is commonly known. Each HTML version has a corresponding DTD. Now you may be asking, "What does all this have to do with CSS?"
If you want all the content on your web page to display correctly and consistently on a web browser, you have to tell the web browser that you are using HTML or XHTML Which version does it include, what does the doctype declaration at the beginning of a web page mean. This document type declaration is the first line of the HTML file and not only defines the version of HTML you are using (such as HTML 4.01 Transitional), but also points to the appropriate DTD file in the web page. When you type the wrong document statement, you put most browsers into a warning state called Quirks Mode.
Quirks Mode is a method used by browser manufacturers to make their software run like browsers from circa 1999 (the era of Netscape 4 and Internet Explorer 5). If a modern browser encounters a web page without the correct document type, it will think: "Well, this page must have been written in an HTML editor a long time ago. I have to pretend that I am a really old browsers to display web pages, just like those buggy old browsers did." This is why your lovely web page that you styled with CSS may not look like it when you don't have a correct document type. How it should appear according to current standards. When you check your browser and inadvertently view your page in Quirks Mode, you may stop trying to fix the issue related to incorrect document types rather than improper use of HTML or CSS. display problem.
Fortunately, getting the right document type is easy. All you need to know is which HTML version is being used. Currently the most popular versions of HTML and XHTML are HTML 4.01 Transitional and XHTML 1.0 Transitional. These HTML types still let you use presentational tags such as tags, and in this regard also provide a transition from older versions of HTML to newer versions of HTML: stricter HTML and XHTML tags. Although it's best not to use these tags, they still work in Transitional Edition, so you can phase out these old-style tags according to your situation. In strict versions of HTML and XHTML, some old-style tags don't work at all.
Note: Generally speaking, strict versions of HTML and XHTML do not accept tags and attributes that simply make the page look good, such as tags and the centered attribute of a paragraph. They also don't accept some once-popular attributes, such as a link's target attribute - which lets you open the link in a new window.