J
J
JonyRock2011-07-12 19:28:13
HTML
JonyRock, 2011-07-12 19:28:13

Oddities in w3c validation and

Why is it valid: and this:

<!DOCTYPE HTML>
<head>
<title>Title of the document</title>
</head>
</html>




<!DOCTYPE HTML>
<head>
<title>Title of the document</title>
</head>
</body>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
lashtal, 2011-07-12
@JonyRock

dev.w3.org/html5/spec/Overview.html#optional-tags
A head element's start tag may be omitted if the element is empty, or if the first thing inside the head element is an element.
A body element's start tag may be omitted [...]

S
sl_bug, 2011-07-12
@sl_bug

You will be surprised, but this is also valid.

<!DOCTYPE HTML>
<title>Title of the document</title>
<h1>1</h1>
<div>bla</div>
<header>bbb</header>
<footer>ddd</footer>

<html>, <head> and <body> tags are optional!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question