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

Mah*_*esh 3 html css php w3c w3c-validation

在使用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> 
Run Code Online (Sandbox Code Playgroud)

Sir*_*rko 6

来自相应的MDN文件:

允许的内容零个或多个<dt>元素,每个元素后跟一个或多个元素.

您的<p>代码未使用<dl><dt>标记包装.如果您更改此设置,您的代码将会验证.

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

HTML <dl>元素(或HTML描述列表元素)包含一对术语和描述列表.此元素的常见用途是实现词汇表或显示元数据(键值对列表).

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