HTML and CSS checklist
Every rule in the HTML and CSS playbook, by chapter, required rules first. Each links to its own page with how we built it and how to check it. This is a lot to check. An Expert can check it for you.
Structure and files
- Required CSS-35 Keep untrusted data out of stylesheets
- Recommended CSS-1 Load every stylesheet from one entry file
- Recommended CSS-2 Sort styles into five layers
- Recommended CSS-3 Give each component exactly one stylesheet
- Recommended CSS-4 Keep media and container queries with their component
- Recommended CSS-5 Write styles only in stylesheets
The cascade
- Recommended CSS-6 Declare the layer order once
- Recommended CSS-7 Cap selector specificity and keep ids out of selectors
- Recommended CSS-9 Keep !important inside the utilities layer
- Recommended CSS-10 Fence each component's styles in
- Recommended CSS-12 Import third-party CSS into its own layer
Naming and state
- Recommended CSS-15 Show state through attributes
- Recommended CSS-36 Let the hidden attribute always hide
- Recommended CSS-16 Select elements by their own class
- Recommended CSS-17 Prefix a component's custom properties with its name
- Recommended CSS-34 Define every custom property a stylesheet reads
- Recommended CSS-39 Register animated custom properties with @property
- Recommended CSS-18 Keep script hooks apart from style hooks
- Recommended CSS-33 Nest only states and queries one level deep
- Optional CSS-13 Name classes for what the element is
- Optional CSS-14 Use one naming pattern for every class
HTML structure and reuse
- Required CSS-19 Use the native element first
- Required CSS-37 Never read elements through window globals
- Recommended CSS-20 Pass data to templates instead of markup
- Recommended CSS-22 Keep ids unique and stable
- Recommended CSS-24 Clone markup that scripts add from a template element
- Recommended CSS-38 Style web components through parts and custom properties
- Optional CSS-21 Give each template one root element
- Optional CSS-23 Avoid wrapper elements that only hold a class
- Optional CSS-25 Name custom elements with the project prefix
Checks in code
- Recommended CSS-26 Lint styles with one shared config
- Recommended CSS-28 Check the built CSS for limits and unused selectors
- Recommended CSS-29 Lint the built markup for structure
- Recommended CSS-32 Lint every feature against one Baseline target
Related playbooks
Show the badge on your project
When your project passes every Required rule, you can show this badge on your site or in your README. It links to this checklist, so anyone can run the same checks.
<a href="https://agentwranglers.se/playbook/html-css/checklist"><img src="https://agentwranglers.se/badge.svg" alt="Checked against the Agent Wranglers HTML and CSS playbook" width="214" height="20"></a>
[](https://agentwranglers.se/playbook/html-css/checklist)
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/html-css/checklist">Agent Wranglers HTML and CSS playbook</a>. In code you write, add a comment next to it with the same link.