Install

Get started

Copy the stylesheet. Optionally load the script. There is no compile step for a plain page.

1. Link the CSS

That is enough for styled tags, dark mode, layout atoms, cards, and badges. No JavaScript.

<link rel="stylesheet" href="css/html.style.css">
Copy

2. Add behaviour when you need it

<link rel="stylesheet" href="css/html.style.css">
<script type="module" src="js/html.style.js"></script>
<script type="module" src="js/html.style.components.js"></script>
Copy

html.style.js is optional enhancements. html.style.components.js registers every hs-* element. Or import one file from html.style/components/hs-dialog.js. On a file:// page, load html.style.components.classic.js as a classic script instead of the module bundle.

No build is not no server. ES modules are blocked from file:// by CORS. Serve the folder over HTTP, or use html.style.components.classic.js with a classic script tag.

npm, if you already have a bundler

npm install html.style

import "html.style/dist/css/html.style.css";
import "html.style/bundle";
Copy

React, Vue, Angular, Svelte, and Solid notes live in the repository docs/frameworks.md.

Minimal page

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="color-scheme" content="light dark">
  <link rel="stylesheet" href="css/html.style.css">
  <title>My project</title>
</head>
<body>
  <main>
    <h1>Hello</h1>
    <p>Start with semantic HTML.</p>
    <button>Click me</button>
  </main>
  <script type="module" src="js/html.style.js"></script>
</body>
</html>
Copy

Next: tokens and layers, or the element catalog.