... isn"t allowed in <...> elements

Cause:

The structure of a HTML document does not allow to insert all type of tags in all conditions.

Solution:

For example, the structure of the HTML document contains some mandatory tags that are inserted in a defined order.

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

References:

HTML specification: http://www.w3.org/TR/html4/