微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

php – 在此上下文中元素p不允许作为元素dl的子元素. (抑制此子树中的更多错误.)

在使用W3C进行验证时,我遇到了以下错误.

错误:在此上下文中,元素p不允许作为元素dl的子元素.(从此子树中抑制更多错误.)”.

有谁知道如何解决这个问题?

<dl>

    <dt>Comments</dt>
    <dd class="auto">
      <textarea name="cus-other-info" cols="45" rows="5" id="cus-other-info-id"></textarea>
    </dd>



    <p class="cap">ReCAPTCHA entry is for testing whether you are a human visitor and to prevent automated spam submissions.</p>
    <dd class="auto recaptcha">
    <div class="recaptcha-item">
      <script type="text/javascript" src="http://www.google.com/recaptcha/api/challenge?k=6LfaXscSAAAAAMcN5Mfvza9CyYfV7K5__BbQiPBN"></script>

<noscript>
    <iframe src="http://www.google.com/recaptcha/api/noscript?k=6LfaXscSAAAAAMcN5Mfvza9CyYfV7K5__BbQiPBN" height="300" width="500" frameborder="0"></iframe><br/>
    <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
    <input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
</noscript>                </div>
    </dd>
    <p><sup class="required">*</sup> = required Fields</p>
    <dd class="auto recaptcha">
        <div class="submit-item">
     <input type="button" class="reset-but" value="Reset" onclick="clearContForm();" />
      <input type="button" class="submit-but" value="Submit" onclick="formSubmit();" />
      </div>
    </dd>

   </dl> 

解决方法:

从各自的MDN docu

Permitted content Zero or more <dt> elements, each followed by one or more elements.

你的< p>标签未包含< dl>或者< dt>标签.如果您更改此设置,您的代码将会验证.

此外,我建议使用标签,以满足他们的需求.再次引用MDN:

The HTML <dl> Element (or HTML Description List Element) encloses a list of pairs of terms and descriptions. Common uses for this element are to implement a glossary or to display Metadata (a list of key-value pairs).

从上面的代码中,我假设您只是将其用于布局和/或样式目的.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐