Mawg
Mawg

Reputation: 40140

Why won't this validate?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
  <title>title</title>
</head>

<body>

<form action="next.php" method="post">

<input type="text" name="my_input">

</form>

</body>
</html>

Upvotes: 0

Views: 70

Answers (2)

kennytm
kennytm

Reputation: 523264

The validator already told you the reasons.

document type does not allow element "INPUT" here; missing one of "P", "H1", "H2", "H3", "H4", "H5", "H6", "PRE", "DIV", "ADDRESS" start-tag

Use

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
  <title>title</title>
</head>

<body>

<form action="next.php" method="post">

<p><input type="text" name="my_input"></p>

</form>

</body>
</html>

Upvotes: 4

Darin Dimitrov
Darin Dimitrov

Reputation: 1038770

Because according to this DTD inputs need to be nested in one of the following tags: P, H1, H2, H3, H4, H5, H6, PRE, DIV, ADDRESS:

<p>
    <input type="text" name="my_input">
</p>

Upvotes: 3

Related Questions