<tbody>标签显示在 chrome 中,但不是源代码 [英] <tbody> tag displays in chrome but not source
问题描述
在做一些抓取工作时,我一直在 Chrome DevTools 检查器中遇到 In doing some scraping work I keep encountering the 例如,DevTools 显示: For example, DevTools shows: 页面源显示: The start tag for 它是需要的,因为规则说你不能在 And it is needed, because the rules say you can't have a 有关更正式的表述方式,请参见 http://www.w3.org/TR/html-markup/tbody.html For a more formal way of saying this, see http://www.w3.org/TR/html-markup/tbody.html 顺便说一下,同样的情况发生在其他开始标签上,比如 By the way, the very same happens with other start tags, like 这篇关于<tbody>标签显示在 chrome 中,但不是源代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! 标记,但它没有出现在源代码中.由于我希望是显而易见的原因,我觉得这非常令人困惑.这里发生了什么?(我还应该补充一点,此页面上的 html 格式非常错误).
<tbody>
tag in the Chrome DevTools inspector, but it doesn't appear in the source. For what I hope are obvious reasons, I find this super confusing. What's going on here? (I should also add that the html on this page is pretty malformed).<table>
<tbody>
<tr valign="top">
<td>...</td>
<table border="0">
<tr valign="top">
<td>
推荐答案
的开始标记是可选的.也就是说,您可以将其省略,但浏览器会在需要时自动插入.
<tbody>
is optional. That is, you can leave it out, but it is automatically inserted by the browser whenever needed.table
中直接有tr
.table
元素的唯一子元素可以是 caption
、colgroup
、thead
、tbody
> 和 tfoot
.
因此,如果浏览器在 tbody
之外遇到 tr
,它会插入一个 tbody
,tr
将驻留在其中.tr
directly in a table
. The only children of a table
element can be caption
, colgroup
, thead
, tbody
and tfoot
.
So, if the browser encounters a tr
outside a tbody
, it inserts a tbody
which the tr
will reside in..如果你忽略它,比如在
</head>
之后直接写一个 ,浏览器将插入一个隐含的
;
自动.<body>
. If you omit that, writin, say, a <h1>
directly after the </head>
, the browser will insert an implied <body>
automatically.
登录
关闭