0

The indentation was created by Firefox's source. Both Firefox and HTML validators said that the </p> is misplaced. But I can't figure out why.

<p>
  <ul class="errorlist">
    <li>This field is required.</li>
  </ul>
  <label for="id_creator">Creator:</label>
  <select onchange="Dajaxice.doors.orders_create_creator_changed(fill_other_fields, {&#39;creator_pk&#39;: this.options[this.selectedIndex].value})" name="creator" id="id_creator">
    <option value="" selected="selected">Select a user</option>
    <option value="9">Amy the Tenant</option>
    <option value="6">Alex the Tenant</option>
    <option value="3">Bob the Property Manager</option>
  </select>
</p>

On a side note, when Django doesn't render the error messages, then the closing </p> tag is valid. Here is the code:

<p>
  <label for="id_creator">Creator:</label>
  <select onchange="Dajaxice.doors.orders_create_creator_changed(fill_other_fields, {&#39;creator_pk&#39;: this.options[this.selectedIndex].value})" name="creator" id="id_creator">
    <option value="" selected="selected">Select a user</option>
    <option value="9">Amy the Tenant</option>
    <option value="6">Alex the Tenant</option>
    <option value="3">Bob the Property Manager</option>
  </select>
</p>
4

2 回答 2

3

<p>不能包含任何块级元素(参见 MDN 文档)。

<ul>另一方面是块级元素(MDN)。

您的代码可能“正确”显示的原因是大多数 html5 解析器</p>在遇到<p>. 随着这个被插入,你的实际</p>没有伴随的开口<p>,因此在那个时候是无效的。

于 2012-04-21T09:28:19.730 回答
1

an<ul />是块级别,因此不能放在 a 中<p />

于 2012-04-21T09:17:58.483 回答