范围内没有p元素,但是有一个p结束标签seen.w3c验证 [英] No p element in scope but a p end tag seen.w3c validation

查看:458
本文介绍了范围内没有p元素,但是有一个p结束标签seen.w3c验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的HTML如下。我已经打开所有元素并关闭它们。仍然当我检查它在W3C它显示错误。我无法弄清楚。

 <!doctype html> 
< html>
< head>
< meta charset =utf-8>
< title>无标题文档< / title>
< / head>

< body>
< p>
< div class =inr_content clearfix>
< div class =col2 first fl>
提供免费接送服务。
< / div>
< div class =col2 last fr>
提供免费接送服务。
< / div>
< / div>
< / p>
< / body>
< / html>


解决方案

这是因为您正在嵌套块级元素 p 标记无效。您只能嵌套内联元素,例如 span a img 内部 p 标记。因此,您的标记无效,请考虑制作类似于

 < div class =inr_content clearfix> 
< div class =col2 first fl>
< p>提供免费接送服务。< / p>
< / div>
< div class =col2 last fr>
< p>提供免费接送服务。< / p>
< / div>
< / div>






来自W3C [1]


P元素表示一段。它不能包含块级别的
元素(包括P本身)。


1 - 参考


My HTML is as as below. I have opened all elements and closed them. Still when I check it on w3c it shows error. I cant figure it out.

<!doctype html>
<html>
    <head>
        <meta charset="utf-8">
        <title>Untitled Document</title>
    </head>

    <body>
        <p>
            <div class="inr_content clearfix">
                 <div class="col2 first fl">
                      to provide a drive-in services.
                 </div>
                 <div class="col2 last fr">
                      to provide a drive-in services.
                 </div>
            </div>
        </p>
    </body>
</html>

解决方案

That's because you are nesting a block level element inside the p tag which is invalid. You can only nest inline elements such as span, a and img inside p tag. So your markup is invalid, consider making something like

<div class="inr_content clearfix">
   <div class="col2 first fl">
      <p>to provide a drive-in services.</p>
   </div>
   <div class="col2 last fr">
      <p>to provide a drive-in services.</p>
   </div>
</div>


From W3C[1] :

The P element represents a paragraph. It cannot contain block-level elements (including P itself).

1 - Reference

这篇关于范围内没有p元素,但是有一个p结束标签seen.w3c验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆