如何使用vs2012更正asp.net中的html4 4.01

时间:2022-10-30 14:30:54

In vs 2012 asp.net empty site I am using html4.01 for table desgin I have a <div> (a couple actually) and i keep getting a warning that reads:

在vs 2012 asp.net空站点我使用html4.01用于表设计我有一个

(实际上是一对)并且我一直收到一条警告:

    </div>
    <div style="text-align:center;">
       <table style="text-align:left; border-color:aqua;background-color:gold;border-width:2px;"cellspacing ="0" cellpadding ="8" rules ="none" width ="540">
        <tr>
            <td valign ="top">
                Me
            </td>
        </tr>
    </table>
    </div>


Warning 1   Validation (HTML 4.01): Element 'tr' cannot be nested within element 'div'. 

what would cause this?

什么会导致这个?

1 个解决方案

#1


1  

Looking at the code you've posted:

查看您发布的代码:

You have a table, and the nesting looks like you intended to put the <tr> inside it.

你有一个表,嵌套看起来像你打算把放在里面。

However, the table is closed on the same line as it is started, so the <tr> is actually outside the table, after it.

但是,该表在启动时在同一行上关闭,因此实际上在表之外。

Find the closing </table> tag, and move it to where it should be, after the rest of the code that is meant to be inside the table.

找到结束 标记,并将其移动到应该位于表中的其余代码之后。

[EDIT]
Okay, you've now fixed that in the code in the question.

[编辑]好的,你现在已经修复了问题中的代码。

The next problem I can see is that your table tag has the following:

我能看到的下一个问题是你的表标签有以下内容:

border-width:2px;"cellspacing ="0"
                ^^^
          missing space here

The missing space before the cellspacing attribute will cause the tag to be invalid, which could also be breaking it.

cellspacing属性之前缺少的空格将导致标记无效,这也可能会破坏它。

For further HTML validation, I recommend you put your HTML code through the W3C's validator, which will highlight any further issues you may have with your HTML.

对于进一步的HTML验证,我建议您将HTML代码放在W3C的验证器中,这将突出显示您可能对HTML有任何进一步的问题。

#1


1  

Looking at the code you've posted:

查看您发布的代码:

You have a table, and the nesting looks like you intended to put the <tr> inside it.

你有一个表,嵌套看起来像你打算把放在里面。

However, the table is closed on the same line as it is started, so the <tr> is actually outside the table, after it.

但是,该表在启动时在同一行上关闭,因此实际上在表之外。

Find the closing </table> tag, and move it to where it should be, after the rest of the code that is meant to be inside the table.

找到结束 标记,并将其移动到应该位于表中的其余代码之后。

[EDIT]
Okay, you've now fixed that in the code in the question.

[编辑]好的,你现在已经修复了问题中的代码。

The next problem I can see is that your table tag has the following:

我能看到的下一个问题是你的表标签有以下内容:

border-width:2px;"cellspacing ="0"
                ^^^
          missing space here

The missing space before the cellspacing attribute will cause the tag to be invalid, which could also be breaking it.

cellspacing属性之前缺少的空格将导致标记无效,这也可能会破坏它。

For further HTML validation, I recommend you put your HTML code through the W3C's validator, which will highlight any further issues you may have with your HTML.

对于进一步的HTML验证,我建议您将HTML代码放在W3C的验证器中,这将突出显示您可能对HTML有任何进一步的问题。