HTML <summary> 标签与 <details> 标签一起使用。它用作 <details> 元素内容的摘要、标题或图例。
它在 <details> 标签中使用。它必须有一个结束标签。
<summary> 标签是 HTML 5 中的新标签。
<!DOCTYPE> <html> <body> <details> <summary>RocSchool Summary</summary> <p> RocSchool is a popular tutorial website.</p> <p>You can learn various tutorials on RocSchool such as HTML, CSS, JavaScript, Java, Android.</p> </details> </body> </html>
让我们看另一个 HTML 摘要标签的例子
<!DOCTYPE> <html> <body> <details> <summary>MacBook Pro Specification</summary> <ul> <li><strong>13.3-inch LED-backlit glossy widescreen display</strong> with edge-to-edge, uninterrupted glass (1280 x 800-pixel resolution).</li> <li><strong>2.4 GHz Intel Core i5 dual-core processor</strong> with 3 MB shared L3 cache for excellent multitasking.</li> <li><strong>Intel HD Graphics 3000</strong> with 384 MB of DDR3 SDRAM shared with main memory.</li> <li><strong>500 GB Serial ATA hard drive</strong> (5400 RPM)</li> <li><strong>4 GB installed RAM</strong> (1333 MHz DDR3; supports up to 8 GB)</li> </ul> </details> </body> </html>
<summary> 标签仅支持 HTML 5 中的全局属性。<summary> 标签没有其他特定的属性。
元素 | Chrome | IE | Firefox | Safari | Opera |
---|---|---|---|---|---|
<summary> | Yes | Yes | Yes | Yes | Yes |