传说中的标题是否有效? <图例>< H1>标题< / H1>< /图例> [英] Is header in legend valid? <legend><h1>Caption</h1></legend>

查看:104
本文介绍了传说中的标题是否有效? <图例>< H1>标题< / H1>< /图例>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Visual Studio中使用它,但编译器声称 h1 不能嵌套在 legend 元素中,但浏览器可以渲染它,所以我很困惑,这是否有效?

 < fieldset> 
<图例>
< h1>标题< / h1>
< / legend>
< / fieldset>


解决方案

浏览器所做的很多事情都不是标准要求: - )

此页这里(HTML4)指定图例关键字,并指出它可以包含内联元素,其中标题不是一部分。它还有其他可能有用的,如 strong



另外, H1 的相关页面不会列出 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.

这篇关于传说中的标题是否有效? &LT;图例&GT;&LT; H1&GT;标题&LT; / H1&GT;&LT; /图例&GT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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