加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – 在此上下文中元素p不允许作为元素dl的子元素. (抑制此子

发布时间:2020-12-13 21:50:42 所属栏目:PHP教程 来源:网络整理
导读:在使用W3C进行验证时,我遇到了以下错误. “错误:在此上下文中,元素p不允许作为元素dl的子元素.(从此子树中抑制更多错误.)”. 有谁知道如何解决这个问题? dl dtComments/dt dd class="auto" textarea name="cus-other-info" cols="45" rows="5" id="cus-oth
在使用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).

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读