MichaelH
MichaelH

Reputation: 1620

HTML 4.01 STRICT Invalid Markup Error

I was attempting to validate my page and was having some issues with the form section. So I created a test page to see what was going on, and it still failed so I think I might be doing something wrong.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> 
<html lang="en">
    <head>
        <title>Test</title>
        <meta http-equiv="Content-type" content="text/html;charset=UTF-8">
    </head>
    <body>
        <form action='test.html'>
            <input type='submit'>
        </form>
    </body>
</html> 

That is my test page. When I copy it into http://validator.w3.org/check it gives me two errors:

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

            <input type='submit'>

And

Error Line 11, Column 9: end tag for "FORM" which is not finished

        </form>

Even without the submit button, it still gives me the second error. Im stuck for the reason why this is happening. Any ideas?

Upvotes: 4

Views: 288

Answers (1)

saunderl
saunderl

Reputation: 1638

You need to have some sort of container tag inside of the Form tag for it to validate. Some use Fieldset, but I always wrap everything in a div thats in my form.

Upvotes: 4

Related Questions