You know that without it, the browser will use quirks mode when rendering the page; you know that different browsers render different elements differently in quirks mode. So you would write a doctype like this: Copy code The code is as follows:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> Fortunately, various web development tools are now powerful enough to support the insertion of template code, so you don’t need to type out this long and smelly doctype letter by letter. But if you've had enough of it, you might try this: Copy code The code is as follows:<!DOCTYPE html> Wow, very concise! The benefits are obvious: 1. You can easily write this doctype without worrying about making mistakes; 2. You save about 105 bytes of characters. For a site with tens of millions of daily PVs, it can save a considerable amount of traffic; 3. It is backward compatible. Yes, the html5 doctype is written like this, and modern browsers recognize it. If you're like me and have always thought that
Note: You don't need to validate your page against your chosen doctype at all; the mere presence of the doctype tag is enough to enable strict mode (standards mode). If you still doubt what I'm saying, go to http://www.quirksmode.org/css/quirksmode.html#link2 to find out what you need to know. We only need a small piece of JavaScript code to get the answer, it is: Copy code The code is as follows:mode=document.compatMode; This code can be used to determine whether the current browser is in quirks mode or standards mode. The compatibility of this property is beyond doubt. If you have doubts, you can check http://www.quirksmode.org/dom/w3c_html.html#t11. You can visit http://wanz.im/demo/doctype-test.html in the browser you want to test and you can see the results. As far as I know, this does not activate quirks mode, even under IE6. If you have any new discoveries, please leave me a message. |
<<: Introduction to the use of MySQL performance stress benchmark tool sysbench
>>: 20 CSS coding tips to make you more efficient (sorted)
I just happened to encounter this small requireme...
1 Start the Docker service First you need to know...
# Installation daemon configuration for Redis on ...
This article example shares the specific code of ...
Although head and DTD will not be displayed on th...
Install lua wget http://luajit.org/download/LuaJI...
File transfer between Windows and Linux (1) Use W...
Recently, the company purchased a DELL R730 serve...
To deploy war with Docker, you must use a contain...
1. Unzip MySQL 8.0.16 The dada folder and my.ini ...
The installation of compressed packages has chang...
Preface Linux groups are organizational units use...
Solution to mysql not closing: Right-click on the...
Table of contents Configure node.js+nvm+npm npm s...
I encountered a strange network problem today. I ...