在摘要标签内使用 h2 标签在语义上是否正确?
Is it semantically correct to use h2 tag inside summary tag?
我不确定在 <summary>
标签中包含 <h2>
标签是否正确。
<summary>
标签内包含 <h2>
或 <h1>
标签在语义上是否有效?
语义将取决于您拥有的具体内容及其出现的上下文。
从有效性的角度来看,the spec说:
Content model:
Phrasing content, optionally intermixed with heading content.
所以,它是有效的。
当然,这是允许的。但是您必须使用 CSS 进行一些样式设置以避免换行。要测试飞行能力,请同时使用 W3-Validator and use the W3Schools。
<!DOCTYPE html>
<html>
<head>
<title>HTML Summary usage</title>
</head>
<body>
<details>
<summary><h1>Copyright 1999-2014.</h1></summary>
<p> - by Refsnes Data. All Rights Reserved.</p>
<p>All content and graphics on this web site are the property of the company Refsnes Data.</p>
</details>
<p><b>Note:</b> The summary element is not supported in Edge/Internet Explorer.</p>
</body>
</html>
我不确定在 <summary>
标签中包含 <h2>
标签是否正确。
<summary>
标签内包含 <h2>
或 <h1>
标签在语义上是否有效?
语义将取决于您拥有的具体内容及其出现的上下文。
从有效性的角度来看,the spec说:
Content model:
Phrasing content, optionally intermixed with heading content.
所以,它是有效的。
当然,这是允许的。但是您必须使用 CSS 进行一些样式设置以避免换行。要测试飞行能力,请同时使用 W3-Validator and use the W3Schools。
<!DOCTYPE html>
<html>
<head>
<title>HTML Summary usage</title>
</head>
<body>
<details>
<summary><h1>Copyright 1999-2014.</h1></summary>
<p> - by Refsnes Data. All Rights Reserved.</p>
<p>All content and graphics on this web site are the property of the company Refsnes Data.</p>
</details>
<p><b>Note:</b> The summary element is not supported in Edge/Internet Explorer.</p>
</body>
</html>