Home  >  Article  >  Web Front-end  >  What is the tag?

What is the tag?

PHP中文网
PHP中文网Original
2017-06-20 13:01:022041browse
DOCTYPE tag is the type declaration of the html document (document type declaration, the so-called declaration, that is, declaring who I am), is used To tell the browser what document type definition(Document Type Definition, DTD, is a general description of the document, what is the structure, what valid tags are there, what attributes are supported, what events are )## to parse the document.
The html document is written by you, and the browser is responsible for rendering it. If you can reach a consensus with all browsers, even if you don't say some words, she can understand you, and you understand her, then it's okay not to declare it, just like you don't have to declare to your dad when you go home, you are Chen Erdan.
But the way different browsers render pages is not consistent. If the same HTML document is rendered by different browsers in their own way, the results will be inconsistent. There are many reasons for this problem, including the original "browser wars" (desperately adding new features and functions to their own browsers in order to grab users and the market), contempt for W3C standards, and the formulation of W3C specifications. sluggishness and so on.
For web developers, this is actually a right. The tag allows you to instruct the browser according to what specification (W3C standard) to parse your code (called standards mode ). If you don't write it, the browser will parse and render the page in its own way (called weird mode). And For browsers, this is a solution to solve compatibility issues. The purpose is to better support W3C standards while also rendering previously designed for older versions of browsers that do not strictly follow W3C standards. web page.

The above is the detailed content of What is the tag?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn