Unknown classes log a warning in the console: [kata-css] Unknown class: "kata-[class]"
How it works
KataCSS is a runtime engine. No compiler, no build step, no CSSOM manipulation.
Runtime
Execution flow
KataCSS listens for DOMContentLoaded. Once the DOM is ready, it scans every element with a class attribute, finds anything starting with kata-, looks it up in a key-value map, writes the CSS as an inline style attribute, and removes the original class.
flow
Browser parses HTML
→ script registers DOMContentLoaded listener
→ DOM finishes loading
→ KataCSS scans all [class] elements
→ finds kata-* classes
→ looks up classMap
→ writes inline style attribute
→ removes kata-* class from classList
Extending
js — classMap.js
// src/classMap.js — add any key you want
classMap["kata-bg-brand"] = "background-color: #FF6B35;";
classMap["kata-text-brand"] = "color: #FF6B35;";
Spacing
All spacing utilities use i × 0.25rem. Scale runs 0-96.
Formula
i × 0.25rem
Scale
0 – 96
kata-p-4
= 1rem / 16px
kata-p-8
= 2rem / 32px
Padding
Class
CSS
Example
kata-p-{n}
padding: n×0.25rem
kata-p-4 → 1rem
kata-px-{n}
padding-left + right
kata-px-6 → 1.5rem
kata-py-{n}
padding-top + bottom
kata-py-2 → 0.5rem
kata-pt/pb/pl/pr-{n}
individual sides
kata-pt-3 → 0.75rem
Margin
Class
CSS
kata-m-{n}
margin: n×0.25rem
kata-mx-{n} / kata-mx-auto
margin-left + right
kata-my-{n}
margin-top + bottom
kata-mt/mb/ml/mr-{n}
individual sides
kata-m-auto
margin: auto
Gap
Class
CSS
kata-gap-{n}
gap: n×0.25rem
kata-gap-x-{n}
column-gap: n×0.25rem
kata-gap-y-{n}
row-gap: n×0.25rem
Layout & Display
Display, box-sizing, and overflow utilities.
Class
CSS
kata-block
display: block
kata-inline / kata-inline-block
display: inline / inline-block
kata-flex / kata-inline-flex
display: flex / inline-flex
kata-grid / kata-inline-grid
display: grid / inline-grid
kata-hidden
display: none
kata-contents
display: contents
kata-box-border / kata-box-content
box-sizing
Flexbox
Direction, wrapping, justification, and alignment.
Direction & wrap
Class
CSS
kata-flex-row / col
flex-direction: row / column
kata-flex-row-reverse / col-reverse
flex-direction reversed
kata-flex-wrap / nowrap / wrap-reverse
flex-wrap
Justify & align
Class
CSS
kata-justify-start / center / end
justify-content
kata-justify-between / around / evenly
justify-content
kata-items-start / center / end
align-items
kata-items-baseline / stretch
align-items
Position & Z-index
Position type, inset values (0–96 scale), and z-index (0–96).