表单标签可以包含正文标签吗? [英] Can a form tag enclose a body tag?

查看:89
本文介绍了表单标签可以包含正文标签吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天,在body标签开始之前,我遇到了一些带有form标签的代码.我的意思是,表单标签包含在主体标签中.这可能吗?如果可以,那么在哪里有帮助?

Today I came accross some code which had a form tag before the body tag began. I mean, the form tag enclosed the body tag. Is this possible? If it is then where is it helpfull?

<form  action="someaction.jsp" method="post">
 <body>
  ...
 </body>
</form>

推荐答案

通过查找W3C Recommendations

By looking up the W3C Recommendations Form elements description, it clearly shows that you better not use that way.

您可以在以下位置使用Form元素:

You can use the Form element in:

可以使用此元素的上下文:流内容在哪里 预期的.

Contexts in which this element can be used: Where flow content is expected.

流内容的描述如下:

文档和应用程序主体中使用的大多数元素 被归类为流内容.

Most elements that are used in the body of documents and applications are categorized as flow content.

因此,由于不遵循这些建议,因此任何HTML验证程序也将向您报告错误,因为在正文定义中未找到打开开始标记的表单.这是完全有效的,因为:

So by not following these recommendations, any HTML validators will also report you errors, since the forms opening closing tags are not found in side the body definition. Which is perfectly valid since:

在text/html中省略标签:两个标签都不能省略.

这篇关于表单标签可以包含正文标签吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆