Markup validation for doctype

Markup validation for doctype
But recently I found that using this method will cause problems, see the code:

Copy code
The code is as follows:

<!DOCTYPE HTML>
<html>
<head>
<title>test page</title>
</head>
<body>
<p><div>a</div></p>
</body>
</html>

If this code is tested with w3c markup validation, it is found that it can pass the validation. Because html5 validation is still in the experimental stage, it does not detect any illegalities.

But if you use <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">, you will find that it does not validate.

The reason is that the p tag is special and cannot contain the block tag. It seems that using some experimental features too early may also cause problems. To be on the safe side, it is recommended to use <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">.

<<:  Detailed explanation of four solutions for implementing in-line scrolling on mobile devices

>>:  CSS -webkit-box-orient: vertical property lost after compilation

Recommend

Vue uses WebSocket to simulate the chat function

The effect shows that two browsers simulate each ...

Pure CSS and Flutter realize breathing light effect respectively (example code)

Last time, a very studious fan asked if it was po...

Common usage of hook in react

Table of contents 1. What is a hook? 2. Why does ...

Vue parent-child component mutual value transfer and call

Table of contents 1. Parent passes value to child...

Vue implements setting multiple countdowns at the same time

This article example shares the specific code of ...

How to configure MySQL master-slave synchronization in Ubuntu 16.04

Preparation 1. The master and slave database vers...

Example code for configuring monitoring items and aggregated graphics in Zabbix

1. Install Zabbix Agent to monitor the local mach...

How to use squid to build a proxy server for http and https

When we introduced nginx, we also used nginx to s...

...

Detailed explanation of ECharts mouse event processing method

An event is an action performed by the user or th...

Writing tab effects with JS

This article example shares the specific code for...

Vue implements countdown between specified dates

This article example shares the specific code of ...