使用没有表单标签的fieldset标签是错误的吗? [英] Is it wrong to use the fieldset tag without form tag?

查看:171
本文介绍了使用没有表单标签的fieldset标签是错误的吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以使用 fieldset 标签,而不用在表格中。因为我喜欢它包含图例&内部html的边界。当我使用它来包含 li 元素时,它的行为与它在表单内的实际存在(可视化)一样。

I was wondering if I can use the fieldset tag without being inside a form. Because I like the way it encloses the legend & the border stuff around the inner html. When I use it to enclose li element, it does behave like its actually there(visual) inside a form.

推荐答案

这是有效的HTML5。将以下HTML粘贴到验证程序: http://validator.w3.org/check

It's valid HTML5. Paste the following HTML at the validator: http://validator.w3.org/check:

<!DOCTYPE html>
<html>
<head><title>Title</title></head>
<body>
    <fieldset> <legend>Test</legend> </fieldset>
</body>
</html>

这也是有效的HTML4。将<!DOCTYPE html> 替换为以下内容,并且它仍然通过验证:

It's also valid HTML4. Replace <!DOCTYPE html> with the following, and it still passes the validation:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

这篇关于使用没有表单标签的fieldset标签是错误的吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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