开发者

Validator miss a p tag but it's there!

开发者 https://www.devze.com 2023-01-27 15:43 出处:网络
I have the following markup: <foote开发者_如何转开发r> <p id=\"foo\"> &copy;Copyright. <address><a href=\"\" title=\"Web Development\">Me</a></address>. Todos

I have the following markup:

<foote开发者_如何转开发r>
    <p id="foo">
        &copy;Copyright. <address><a href="" title="Web Development">Me</a></address>. Todos os direitos reservados.
    </p>
</footer>

But W3 Validator (HTML 5) says:

Error Line 81, Column 20: No p element in scope but a p end tag seen.

                </p>

I do have a p tag. What's wrong? Thank you.


Problem: <p> cannot contain an <address> block

You can nest a <p> inside an <address>! An <address> block just means that there's address information to be found within it. It does not need to be wrapped tightly around the address itself.

http://www.whatwg.org/specs/web-apps/current-work/multipage/sections.html#the-address-element


The Layout-Problem:

why use a wrapper like 'p or 'div for the layout coding anyway? as a block-level element you can use 'adress directly as your container-box and format it with any css as you like. keep code minimal and simple.

The Semantic-Problem:

also you dont need a wrapping 'p for the semantics, as 'adress explains its contents already very well. just use it ;-)

The Syntax-Problem:

and yes, other answers are right: 'p contains legally only inline-/inline-block-elements, no block-level-elements allowed


This might be because of you are using HTML5 tags(which is not yet completed by W3c). So simply use divs in order to maintain cross browsing issues.

0

精彩评论

暂无评论...
验证码 换一张
取 消