gpt4 book ai didi

html - 为什么

里面不允许

转载 作者:技术小花猫 更新时间:2023-10-29 12:29:38 25 4
gpt4 key购买 nike

为什么不能<p>嵌套在 <table> 中?我可以做哪些更正?删除 <div><p>标签破坏了我的设计。由于网站遵循客户提供的设计。

我有以下代码,它在 VS2008 中运行良好,但我收到警告:


代码

<div class="right_articles">
<p>
<table>
<tr>
<td>
<img alt="Img not found" src="images/ribbon.gif" style="width: 155px; height: 125px;" />
</td>
<td>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label><br />
<asp:Label ID="Label2" runat="server" Text="Label"></asp:Label><br />
<asp:Label ID="Label3" runat="server" Text="Label"></asp:Label>
</td>
</tr>
</table>
</p>
<p>&nbsp;</p>
<p>
<table>
<tr>
<td>
<img alt="Img not found" src="images/medal.gif" style="width: 155px; height: 125px;" />
</td>
<td>
<asp:Label ID="Label4" runat="server" Text="Label"></asp:Label><br />
<asp:Label ID="Label5" runat="server" Text="Label"></asp:Label><br />
<asp:Label ID="Label6" runat="server" Text="Label"></asp:Label>
</td>
</tr>
</table>
</p>
</div>

警告

Warning 1 This end tag has no matching start tag.
E:\WebSite4\test.master 121

Warning 2 Validation (XHTML 1.0 Transitional):
Text is not allowed between the opening and closing tags for element html'.
E:\WebSite4\test.master 5

Warning 3 Validation (XHTML 1.0 Transitional):
Element 'form' is missing its closing tag.
E:\WebSite4\test.master 21

Warning 4 The class or CssClass value is not defined.
E:\WebSite4\test.master 33

Warning 5 File 'spacer.gif' was not found.
E:\WebSite4\test.master 116

Warning 7 Validation (XHTML 1.0 Transitional):
Element 'img' is missing required attribute 'alt'.
E:\WebSite4\test.master 116

Warning 8 Validation (XHTML 1.0 Transitional):
Element 'table' cannot be nested within element 'p'.
E:\WebSite4\test.master 78

Warning 9 Validation (XHTML 1.0 Transitional):
Element 'table' cannot be nested within element 'p'.
E:\WebSite4\test.master 93

最佳答案

在 HTML 中,理解 P elements 很重要不能包含其他 block 级元素并且 TABLE 是 block 级元素。 P 结束标记是可选的,当您尝试使 P 元素包含它不能包含的内容时,结束 P 标记由浏览器。

The P element represents a paragraph. It cannot contain block-level elements (including P itself).

http://www.w3.org/TR/html401/struct/text.html#h-9.3.1

关于html - 为什么<p>里面不允许<table>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10086912/

25 4 0