HTML open 属性

htmlweb developmentfront end technology更新于 2024/5/23 14:04:17

HTML open 属性定义 details HTML 元素内容在 HTML 文档中是否可见(打开)。

语法

以下是语法 −

<details open></details>

让我们看一个 HTML open 属性的示例 −

示例

<!DOCTYPE html>
<html>
<style>
   body {
      color: #000;
      height: 100vh;
      background-color: #8BC6EC;
      background-image: linear-gradient(135deg, #8BC6EC 0%, #9599E2 100%);
      text-align: center;
   }
</style>
<body>
<h1>HTML low Attribute Demo</h1>
<details open>
<summary>Hi! I'm a summary element</summary>
<p>Hi! I'm a paragraph element with some dummy text</p>
</details>
</body>
</html>

输出


相关文章


有用资源