简体   繁体   English

看到开始标记头但是已经打开了相同类型的元素

[英]Start tag head seen but an element of the same type was already open

I have tried to process my web page in the W3C validator. 我试图在W3C验证器中处理我的网页。 But it always shows that the Start tag head seen but an element of the same type was already open.But If I remove the start tag of <head> ,it passed. 但它始终显示已看到Start标记头但是已经打开了相同类型的元素。但是如果我删除<head>的开始标记,则它会通过。 If I add the start tag, the error arises again. 如果我添加开始标记,则会再次出现错误。 Why does this happen. 为什么会这样呢? Here is the my code 这是我的代码

    <!DOCTYPE html>
<html>
<style type="text/css">
table,th,td{
    border:1px solid black;
}
</style>
<head>
<title>Rui's Calendar</title>
<meta charset="UTF-8">
</head>
 <body>
  <h1>Rui's Calendar</h1>
  <table style="width 100%">
   <tr style="color: blue">
     <th>
      <p>Monday</p> 
     </th>
     <td>
      <p><i>9:00-9:50 AM</i><br>PHY 1302 Willey Hall</p>    
     </td>
     <td>
      <p><i>11:00-12:00 AM</i><br>  -   </p>
     </td>
     <td>
     <p><i>5:45-6:30 PM</i><br>CSCI 4041 Akerman Hall</p>
     </td>
   </tr>
   <tr style="color:red">
     <th>
      <p>Tuesday</p>    
     </th>
     <td>
      <p><i>9:00-9:50 AM</i><br>PHY 1302 <a href="http://campusmaps.umn.edu/willey-hall"></a>>Willey Hall</p>
     </td>
     <td>
      <p><i>1:00-2:15 PM</i><br>CSCI 4707 Fraser Hall</p>
     </td>
     <td>
     <p><i>2:30-3:45 PM</i><br>CSCI 4131 Bruininks Hall</p>
     </td>
   </tr>
   <tr style="color: blue">
     <th>
      <p>Wednesday</p>
     </th>
     <td>
      <p><i>9:00-9:50 AM</i><br>PHY 1302 Blegen Hall</p>    
     </td>
     <td>
      <p><i>1:00-2:15 PM</i><br>-</p>
     </td>
     <td>
     <p><i>2:30-3:45 PM</i><br>-</p>
     </td>
   </tr>
   <tr style="color: red">
     <th>
      <p>Thursday</p>   
     </th>
     <td>
      <p><i>9:00-9:50 AM</i><br>PHY 1302 Blegen Hall</p>    
     </td>
     <td>
      <p><i>1:00-2:15 PM</i><br>CSCI 4707 <a href="http://campusmaps.umn.edu/fraser-hall">Fraser Hall</a></p>
     </td>
     <td>
     <p><i>2:30-3:45 PM</i><br>CSCI 4131 Bruininks Hall</p>
     </td>
   </tr>
   <tr style="color: blue">
     <th>
      <p>Friday</p>>    
     </th>
     <td>
      <p><i>9:00-9:50 AM</i><br>PHY 1302 Willey Hall</p>    
     </td>
     <td>
      <p><i>1:00-2:15 PM</i><br>-</p>
     </td>
     <td>
     <p><i>2:30-3:45 PM</i><br>-</p>
     </td>
   </tr>


  </table>
 </body>
</html>

If you must include the style tag, include it inside the head tag. 如果必须包含样式标记,请将其包含在head标记内。 This should fix your error. 这应该可以解决您的错误。 Preferably, you would use a separate CSS file for the styling though. 最好,您可以使用单独的CSS文件进行样式设置。

The error "Start tag head seen but an element of the same type was already open." 错误“看到开始标记head但是同一类型的元素已经打开”。 occurs because the start tag for the head element is optional. 因为head元素的start标记是可选的。

Since the style element can only exist inside the head, the parser knows to open the head element when it encounters the <style> , basically inserting an invisible <head> start tag. 由于样式元素只能存在于头部内部,因此解析器知道在遇到<style>时打开head元素,基本上插入一个不可见的<head>开始标记。
No error or warning is generated there, because, as I said, the <head> start tag is optional. 这里没有生成错误或警告,因为正如我所说, <head>开始标记是可选的。 Leaving it out is fine. 离开它很好。 (Not recommended though.) (不推荐。)
But then the parser encounters your <head> start tag, and the error occurs, because the head was already open! 但是然后解析器遇到你的<head>开始标记,并且发生了错误,因为头已经打开了!

Hope this explains things. 希望这可以解释事情。

暂无
暂无

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

相关问题 “看到开始标记头但是同一类型的元素已经打开” - “Start tag head 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 W3C HTML5 错误开始标签头看到但相同类型的元素已经打开 - W3C HTML5 ERROR Start tag head seen but an element of the same type was already open 看到一个开始标记,但是相同类型的元素已经打开 - An a start tag 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 已看到开始标记“a”,但已打开相同类型的元素 - Start tag "a" 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 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” 如何在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 W3C验证程序:“看到一个开始标记,但是相同类型的元素已经打开。” - W3C validator: “Start tag a seen but an element of the same type was already open.”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM