mirza
mirza

Reputation: 5793

Why does the W3C validator say there was an error in this code?

The error is:

No p element in scope but a p end tag seen.

And according to the W3C validator the error is caused by this part:

<p>
    <a href="">Anasayfa</a> » <a title="Emlak Bul" href="Emlak-Bul">Emlak Bul</a> » <a title="Mersin Emlak İlanları" href="ilan/siralama/Mersin-Emlak-İlanları">Mersin</a> » <a title="Mersin Satılık Emlak İlanları" href="ilan/siralama/Mersin-Satılık-Emlak-İlanları">Satılık</a> » <a title="Mersin Satılık Ev Konut" href="ilan/siralama/Mersin-Satılık-Ev-Konut">Ev Konut</a> » Yazlık
    <div id="kategori_degistir">
        <p>
            Aramanızı Daraltın
        </p>
        <p>
            İlçe : <a title="Mersin Erdemli Satılık Yazlık" href="ilan/siralama/Mersin-Erdemli-Satılık-Yazlık">Erdemli</a>, <a title="Mersin Mezitli Satılık Yazlık" href="ilan/siralama/Mersin-Mezitli-Satılık-Yazlık">Mezitli</a>
        </p>
        <p>
            Özellik : <a title="Mersin Satılık Yazlık 1+1" href="ilan/siralama/Mersin-Satılık-Yazlık-1+1">1+1</a>, <a title="Mersin Satılık Yazlık 2+1" href="ilan/siralama/Mersin-Satılık-Yazlık-2+1">2+1</a>, <a title="Mersin Satılık Yazlık 3+1" href="ilan/siralama/Mersin-Satılık-Yazlık-3+1">3+1</a>, <a title="Mersin Satılık Yazlık 4+1" href="ilan/siralama/Mersin-Satılık-Yazlık-4+1">4+1</a>, <a title="Mersin Satılık Yazlık 4+2" href="ilan/siralama/Mersin-Satılık-Yazlık-4+2">4+2</a>
        </p>
    </div>
</p>

You can check that error from this link.

Am I missing something here? Or is this a bug?

Upvotes: 2

Views: 1887

Answers (3)

buley
buley

Reputation: 29208

The p tag can contain only "inline" elements and isn't supposed to contain a div "block" level element.

Another tiny note is that you're not supposed to have empty anchor tags (<a href="">). People usually add an empty hash in there <a href="#">

Upvotes: 0

Quentin
Quentin

Reputation: 943571

A paragraph cannot contain a div, but the end tag for the paragraph element is optional.

<p><div> means the same as <p></p><div>

Consequently, when you have your actual </p>, the paragraph is already closed.

Upvotes: 5

Niet the Dark Absol
Niet the Dark Absol

Reputation: 324640

You are using a p tag to contain div and other p.

The p tag was intended to contain text and other inline elements, NEVER block-level elements. This is why the validator is telling you off.

Upvotes: 1

Related Questions