问题描述
我在Visual Studio中使用它,但编译器声称 h1
不能嵌套在 legend
元素中,但浏览器可以渲染它,所以我很困惑,这是否有效?
< fieldset>
<图例>
< h1>标题< / h1>
< / legend>
< / fieldset>
浏览器所做的很多事情都不是标准要求: - )
此页(HTML4)指定图例
关键字,并指出它可以包含,其中标题不是一部分。它还有其他可能有用的,如大
或 strong
。
另外,的相关页面不会列出 legend
作为它允许包含在其中的项目之一。您也可以使用 id
, class
或 style
属性来设置基础文本属性。
I use this in visual studio but the compiler claimed that h1
cannot be nested in legend
element, but browser can render it anyway so i am confused that this is valid or not?
<fieldset>
<legend>
<h1>Caption</h1>
</legend>
</fieldset>
There are many things that browsers do that aren't required by the standards :-)
This page here (HTML4) specifies the legend
keyword and states that it can contain inline elements, of which the headers are not a part. It does have other possibly useful ones such as big
or strong
.
In addition, the relevant page for H1 does not list legend
as one of the items it's allowed to be contained within. You may also be able to use the id
, class
or style
attributes of the legend to set the underlying textual properties.
这篇关于传说中的标题是否有效? <图例>< H1>标题< / H1>< /图例>的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!