If you use the W3C Validator to check a simple document:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Title</title>
<meta charset="utf-8">
</head>
<body>
<span>
<div><p>Some text</p></div> Some text
</span>
</body></html>
it does not report an error when validating it as HTML5. If you set the doctype to "HTML 4.01 Transitional" it does. Perhaps this is just because the HTML5 validation is experimental?
The html5.validator.nu service does report an error however
参考文献
- http://stackoverflow.com/questions/2919909/nesting-div-within-span-problem
- http://diophung.blogspot.jp/2014/03/web-developer-conform-to-w3c-standards.html
- http://doctype.com/span-contain-div-html5
- https://www.w3.org/wiki/Generic_containers_-_the_div_and_span_elements
- https://www.w3.org/TR/html401/struct/global.html#h-7.5.3
网友评论