1

The Following Code i wrote will not pass the W3C validator, instead it will give me the following Error:

Line 18, Column 7: end tag for element "P" which is not open

Its the closing </p> tag imediately after the </ul> tag. And im realy having trouble to nail the problem down. Here is the markup:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="de">
    <head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
    <title>foo</title>
    </head>
    <body>


    <div class="foo1">
        <div class="foo2">
            <h1>some heading</h1>
                <p>
                    <ul>
                    <li>some stuff</li>
                    <li>yet another stuff</li>
                    </ul>
                </p>
                <p>yet another heading</p>
        </div>
    </div>
    </body>
    </html>
Daniel Jawna
  • 339
  • 1
  • 3
  • 17

3 Answers3

2

Check this Q&A

In HTML4 it's invalid to put ul inside p.

Community
  • 1
  • 1
ZZ-bb
  • 2,157
  • 1
  • 24
  • 33
1

The W3C Validator does not allow you to put <ul> inside <p></p> for HTML 4.01 Strict. It also doesn't require the </p>.

So you can solve your problem by removing the </p> or removing both <p> and </p>.

egrunin
  • 24,650
  • 8
  • 50
  • 93
1

Ul not allowed in <p> Tag in Html 4. better try like this.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="de">
    <head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
    <title>foo</title>
    </head>
    <body>


    <div class="foo1">
        <div class="foo2">
            <h1>some heading</h1>

                    <ul>
                    <li>some stuff</li>
                    <li>yet another stuff</li>
                    </ul>

                <p>yet another heading</p>
        </div>
    </div>
    </body>
    </html>
Moiz
  • 2,409
  • 5
  • 27
  • 50