No p element in scope but a p end tag seen как исправить

Since the syntax of the p element does not allow a div child, and the end tag </p> may be omitted, the validator (and a browser) implies </p> when it encounters a <div> tag when parsing a p element. That is, when p is being parsed (or “is open”), the start tag of a div element implicitly closes it, as if the markup had:

<body>
    <p>
        </p><div class="inr_content clearfix">
             <div class="col2 first fl">

This means that there is a p element with only whitespace in it. The </p> tag that appears later thus has no matching start tag, and it is reported as invalid. Browsers ignore such homeless end tags, but validators have to report them.

The minimal change is to remove the </p> tag. Whether this is adequate depends on what you want. Removing the <p> tag as well would remove the p element, and this would affect rendering. Even though the p element has no content rendered (content height is 0), it has default top and bottom margin, possible creating some empty vertical space.

If you do not want such space, just remove the <p> tag (along with </p> of course). If you do want some space, it is usually still best to remove the tag, but then you would additionally set, in CSS, some suitable margin-top value on the top-level div element.

Even though p elements containing only whitespace are allowed in HTML5, they are not recommended. This is part of the general recommendation related to so-called palpable content: “elements whose content model allows any flow content or phrasing content should have at least one node in its contents that is palpable content”. And text is usually palpable content, but not if it consists of whitespace only.

Здравствуйте!
Есть вот такой код:

<p>Поиск по ID:↩
						<form name='id_search'>↩
							<input type='text' placeholder ='Введите ID' name='id' required>↩
							<input type='button' value='Отправить'>↩
						</form>↩
					</p>↩
					<p>Поиск по имени:↩
						<form name='name_search'>↩
							<input type='text' name='name' placeholder='Введите Имя' required>↩
							<input type='button' value='Отправить'>↩
						</form>↩
					</p>↩

Валидатор ругается на закрывающие теги параграфов
No p element in scope but a p end tag seen.
Никак не могу взять в толк, что ему нужно?

A closing tag </li> has been found, but there were open elements nested inside the <li>. You need to close the nested elements before you close the <li>.

A closing tag </li> has been found, but there were open elements nested inside the <li>. You need to close the nested elements before you close the <li>.

For example:

<li>
  <span>example
</li>

The above is invalid because you need to close the <span> tag before you close the <li>.

This would be valid:

<li>
  <span>example</span>
</li>

Your HTML markup contains an end tag for X, but there are nested open elements that need to be closed first. For example, <li><span>example</li> is invalid because you need to close the <span> tag before you close the <li>. This would be valid: <li><span>example</span></li>.

And end tag for element X has been found with no corresponding opening tag for it. Most of the times this is due to closing the same tag twice.

6,250 HTML checks per week. Fully automated.

Save time using our automated web checker. Let our crawler check your web pages on the W3C Validator.

Please post the source of a document or document fragment that causes this error to be emitted

Mostly likely this is reported because the document has something like this:

<p>
  <ul>
  …
  </ul>
</p>

In that case what that document really looks like, as seen by an HTML parser, is this:

<p></p>
  <ul>
  …
  </ul>
</p>

That’s because, the way HTML works is, a <ul> start tag implies a </p> close tag for any open p elements.

Учитывайте, что <p> — коварный тег, он неявно закрывается перед любым открывающим «блочным тегом». Так что конструкции <p>абзац</p><h3>заголовок</h3> и <p>абзац<h3>заголовок</h3> эквивалентны (и обе валидны, хотя с виду у второй закрывающие теги не сходятся!), а вот <p>абзац<h3>заголовок</h3></p> — уже ошибка («закрывающий тег для неоткрытого тега <p>» — потому что первый <p> благополучно неявно закрылся перед заголовком).

И вложить <p> в <p> нельзя по той же причине. Если надо вкладывать во что-то целые абзацы и списки, используйте <div> или (по ситуации) его модные «семантичные» аналоги.

Понравилась статья? Поделить с друзьями:
  • Как составить дорожную карту для педагогов
  • Конкурсы в инстаграм как найти
  • Как составить распоряжения структурным подразделениям
  • Как найти тиммейта в антюрнед
  • Как составить закрывающий акт