跳到正文
语言22
菜单

文档 / 框架

纯 HTML

在任何页面里使用项目的 HTML 版本:引入两个文件,粘贴一段标记。无需构建,无需框架。

版本
HTML
需要
无
设置时间
约 1 分钟

设置

  1. 获取文件

    在项目页面把“获取”切换到 HTML,点“下载 zip”。或者在“代码”视图里逐个复制文件。

    glow-button-html.zip
    glow-button-html/
      index.html
      script.js
      style.css
  2. 引入文件

    把 style.css 和 script.js 放在你的页面旁边,并在页面里引入一次。

    你的页面
    <link rel="stylesheet" href="style.css" />
    <script src="script.js" defer></script>
  3. 粘贴标记

    在项目的 index.html 里,复制“copy from here”和“to here”两条注释之间的内容,粘贴到项目要显示的位置。

    index.html
    <button class="glow-button" type="button">
      <span class="glow-button-label">Get started</span>
    </button>

须知

  • Vue 和 Svelte:把标记放进某个组件的模板,并在 index.html 或根布局里引入这两个文件一次。
  • Laravel:把文件放进 public/,在 Blade 布局里用 asset() 引入,并把标记粘贴到 Blade 视图里。
  • WordPress:把文件放进你的主题,在 functions.php 里用 wp_enqueue_style 和 wp_enqueue_script 加载,或把标记粘贴到“自定义 HTML”区块里。
  • script.js 会在运行时为页面上已有的标记做初始化。对于框架稍后才添加的标记,请再次运行项目的初始化函数:Glow Button 的是 window.initGlowButton()。

其他框架