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

Detailed explanation of js event delegation

1. Each function is an object and occupies memory...

Basic notes on html and css (must read for front-end)

When I first came into contact with HTML, I alway...

Discussion on horizontal and vertical centering of elements in HTML

When we design a page, we often need to center th...

Native JS implements a very good-looking counter

Today I will share with you a good-looking counte...

How to implement Svelte's Defer Transition in Vue

I recently watched Rich Harris's <Rethinki...

Detailed explanation of Mysql transaction isolation level read commit

View MySQL transaction isolation level mysql> ...

The pitfalls and solutions caused by the default value of sql_mode in MySQL 5.7

During normal project development, if the MySQL v...

Introduction to the use and disabling of transparent huge pages in Linux

introduction As computing needs continue to grow,...

JavaScript imitates Jingdong carousel effect

This article shares the specific code for JavaScr...

Example verification MySQL | update field with the same value will record binlog

1. Introduction A few days ago, a development col...

Summary of B-tree index knowledge points in MySQL optimization

Why do we need to optimize SQL? Obviously, when w...

How to implement Linux deepin to delete redundant kernels

The previous article wrote about how to manually ...

Detailed example of clearing tablespace fragmentation in MySQL

Detailed example of clearing tablespace fragmenta...

Comparing Document Locations

<br />A great blog post by PPK two years ago...