简体   繁体   English

HTML5 验证错误:看到正文开始标记,但已打开相同类型的元素

[英]HTML5 Validation Error: body start tag seen but an element of the same type was already open

I was hoping that someone may know how to resolve this HTML5 validation error.我希望有人可能知道如何解决这个 HTML5 验证错误。 When I try to validate my page: http://blog.genesispetaluma.com using http://validator.w3.org , it gives me the following error code:当我尝试使用http://validator.w3.org验证我的页面: http : //blog.genesispetaluma.com 时,它给了我以下错误代码:

Error Line 90, Column 63: An body start tag seen but an element of the same type was already open.错误第 90 行,第 63 列:看到正文开始标记,但已打开相同类型的元素。

<body class="home blog single-author two-column right-sidebar">

I interpreted this error to mean that I have two body tags in the code.我将此错误解释为我在代码中有两个正文标记。 However, I have searched everywhere and can only find one <body> (the one referenced by the error) and one </body> .但是,我到处搜索,只能找到一个<body> (错误引用的那个)和一个</body> Can anyone please tell me how to resolve this error?谁能告诉我如何解决这个错误?

I had a similar problem but with <head> , giving the following W3C markup error:我有一个类似的问题,但是<head> ,给出了以下 W3C 标记错误:

A head start tag seen but an element of the same type was already open看到了一个开头标签,但相同类型的元素已经打开

I had this code:我有这个代码:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<head>

When it was supposed to be:当它应该是:

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

I knew that was wrong but it's hard to spot sometimes, as you're just so used to the header code being correct 99% of the time.我知道这是错误的,但有时很难发现,因为您已经习惯了 99% 的标题代码都是正确的。 I obviously cut n pasted some code and that ended up in the wrong place.我显然剪切 n 粘贴了一些代码,结果放在错误的地方。

This isn't specific to your question, I know, as your error relates to the <body> tag, but this is the kind of thing you're looking for.我知道,这不是针对您的问题,因为您的错误与<body>标签有关,但这是您正在寻找的类型。 Maybe you have a <link> or <meta> tag in your body somewhere, that's meant to be in the <head> .也许你身体的某个地方有一个<link><meta>标签,这意味着在<head> Without seeing your code, it's hard to give you a perfect answer.没有看到你的代码,很难给你一个完美的答案。

Possibly it's because:可能是因为:

<div id="wrapFix">

<div id="drawLogo1">
    <div id="drawLogo2">
        <img src="http://genesispetaluma.com/img/logoNew.png" alt="Genesis Fitness G stylelogo">
    </div>
</div> <!-- end of drawLogo1 -->

Is between your closing head tag and opening body tag.位于结束头标签和开始身体标签之间。 Ie lines 81-87即第 81-87 行

One of the widgets (the facebook like button I believe) you're using is inserting HTML into the page and part of that HTML is a body tag.您正在使用的小部件之一(我相信像 facebook 的按钮)是将 HTML 插入到页面中,并且该 HTML 的一部分是正文标记。 Not sure if there's anything you can do about this, but I think that's what's throwing the error.不确定您是否可以对此采取任何措施,但我认为这就是引发错误的原因。 Looks like this:看起来像这样:

<body class="plugin transparent_widget ff4 win Locale_en_US">
</html>
</iframe>

I got this error:我收到此错误:

A head start tag seen but an element of the same type was already open看到了一个开头标签,但相同类型的元素已经打开

I read this post and then i noticed my tag listed before the head like this.我读了这篇文章,然后我注意到我的标签列在这样的头部之前。

<title>Home</title>
<head>
</head>

it should have been
<head>
<title>Home</title>
</head>

It happens in below said scenarios as per my knowledge -据我所知,它发生在下面所说的场景中 -

  1. When you mistakenly choose <head> thinking <header> tag.当你误选<head>想着<header>标签。
  2. When your <header> , <nav> , <section> or <footer> tag(s) are outside of <body> tag.当您的<header><nav><section><footer>标签位于<body>标签之外时。

So, after creating your page, you can validate these changes here .因此,在创建页面后,您可以在此处验证这些更改。

I got the same error message : check out if any body-inside <element> is displayed between the <head> and <body> , like said above.我收到相同的错误消息:检查<head><body>之间是否显示任何 body-inside <element> <body> ,如上所述。

My error was caused by a <div> tag, with absolute position, to display some page information during the development - simply a line on a false position in the code.我的错误是由具有绝对位置的<div>标记引起的,它在开发过程中显示一些页面信息 - 只是代码中错误位置一行

In my case it was the facebook tag就我而言,它是 facebook 标签

<div id="fb-root"></div>

which was inside the page's <head> .它位于页面的<head>

Moved that to the <body> of the relevant page (not required globally) sorted it.将其移至相关页面的<body> (全局不需要)对其进行排序。 So yes, the answer supplied above by Emil H was correct.所以是的,上面由 Emil H 提供的答案是正确的。

嗨,在我的情况下,hgroup 标签是我遇到验证错误的原因,我从 head 标签中删除了这个标签,然后将它放在 body 标签之后,文档现在有效。

Just for the record, I had exactly the same problem and it seems that including some php files within the head element was strangely giving the problem, even if the view-source of Firefox was not printing such php code nor tags只是为了记录,我遇到了完全相同的问题,似乎在 head 元素中包含一些 php 文件奇怪地给出了问题,即使 Firefox 的视图源没有打印这样的 php 代码或标签

<head>
  <? include("./file.php"); ?>
  <title><? echo $title ?></title>
</head>

solved using:解决使用:

<? include("./file.php"); ?>
<!DOCTYPE html>
<html>
<head>
  <title><? echo $title ?></title>
</head>
<body>
...
...

If Your problem With head and body both are show validate error just remove displaying text from head and keep it in body.. I have been faces the problem recently.如果您的 head 和 body 问题都显示验证错误,只需从 head 中删除显示文本并将其保留在 body 中。我最近遇到了这个问题。 For Example You have text to display in header inside head just remove header from head and keep it in body ......Problem solved...Thanks例如,您有文本要显示在头部内部的标题中,只需从头部删除标题并将其保留在正文中......问题已解决......谢谢

Also bear in mind, if you copy/paste your code from things like slack, etc. they will have 'special characters' for formatting (that are usually invisible) which may cause that issue.另请记住,如果您从 slack 等内容复制/粘贴代码,它们将具有用于格式化的“特殊字符”(通常是不可见的),这可能会导致该问题。

Here is a video to demonstrate: https://drive.google.com/file/d/1OJS15zmSvzhVXVLcQGGhePZGNCxWHocN/view这是一个演示视频: https : //drive.google.com/file/d/1OJS15zmSvzhVXVLcQGGhePZGNCxWHocN/view

This error can happen if you put into <head> tag that restricted to be there.如果您放入限制在那里的<head>标记,则可能会发生此错误。 For example:例如:

 <head> <audio preload="auto" class="menu-beep" id="sound-01"> <source src="sound-01.mp3"> </audio> </head>

In this case, the tag will be immediately opened in the browser memory.在这种情况下,标签将立即在浏览器内存中打开。 But later the browser will find the body tag that opens the page.但是稍后浏览器会找到打开页面的body标签。 This is how it turns out that there is a second body tag.这就是事实证明有第二个身体标签的方式。

I had similar problem with <head> tag.我对<head>标签有类似的问题。 I use https://validator.w3.org我使用https://validator.w3.org

Look at few examples how to solve this problem:看几个例子来解决这个问题:

  • <script> should be inside <head> <script>应该在<head>里面

在此处输入图片说明

  • css should be inside <head> css 应该在<head>里面

在此处输入图片说明

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 HTML验证列19:看到一个正文开始标签,但是相同类型的元素已经打开 - Html Validation Column 19: An body start tag seen but an element of the same type was already open W3C HTML5 错误开始标签头看到但相同类型的元素已经打开 - W3C HTML5 ERROR Start tag head seen but an element of the same type was already open HTML:错误:开始标记已看到但相同类型的元素已打开 - HTML: Error: Start tag a seen but an element of the same type was already open W3C HTML验证错误:“流浪结束标记 </head> ”和“开始标签 <body> 看到了,但是相同类型的元素已经打开了” - W3C HTML validation errors: “Stray end tag </head>” and “Start tag <body> seen but an element of the same type was already open” 已看到开始标记主体,但已打开相同类型的元素 - Start tag body seen but an element of the same type was already open 错误协助:看到开始标签体,但相同类型的元素已经打开,错误:杂散结束标签头 - Assistance with Error: Start tag body seen but an element of the same type was already open and Error: Stray end tag head 如何在HTML中修复“Stray end tag head。”和“Start tag body body,但是已经打开了相同类型的元素。” - How to fix “Stray end tag head.” and “Start tag body seen but an element of the same type was already open.” in HTML “看到了开始标签主体,但相同类型的元素已经打开”并且无法弄清楚如何水平居中? - "Start tag body seen but an element of the same type was already open" & can't figure out how to center horizontally? “看到开始标记头但是同一类型的元素已经打开” - “Start tag head seen but an element of the same type was already open” 看到开始标记头但是已经打开了相同类型的元素 - Start tag head seen but an element of the same type was already open
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM