| name | baseline-ui |
| description | Establish CSS/Tailwind baseline quality — font smoothing, line-height defaults, box-sizing, focus rings, color contrast, Tailwind anti-patterns, and CSS containment. Use when asked to "set up CSS baseline", "Tailwind best practices", "fix font rendering", "global CSS foundation", "typography defaults", "CSS anti-patterns", "improve CSS quality", "line-height reset", "normalize styles", or reviewing a new project's base styles for correctness. Do NOT use for: full design system token architecture — see design-system-gen. Do NOT use for: component-level animation — see motion-design.
|
| origin | adapted:MIT © Ibelick |
| license | MIT © 2026 Vũ Văn Tâm |
| version | 1.0.0 |
| compatibility | Tailwind CSS v3/v4, vanilla CSS. Framework-agnostic. |
When to Use
- Use when: starting a new project and setting up global styles
- Use when: font rendering looks inconsistent across macOS/Windows
- Use when: Tailwind utility soup is making components unreadable
- Use when: auditing a project's base CSS before a UI polish pass
- Do NOT use for: full token system — that's design-system-gen
- Do NOT use for: component animation patterns — that's motion-design
Essential CSS Baseline
*, *::before, *::after {
box-sizing: border-box;
}
html {
-webkit-text-size-adjust: 100%;
text-size-adjust: 100%;
tab-size: 4;
}
body {
margin: 0;
line-height: 1.5;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-synthesis: none;
text-rendering: optimizeLegibility;
}
img, svg, video, canvas, audio, iframe, embed, object {
display: block;
max-width: 100%;
}
p, h1, h2, h3, h4, h5, h6 {
overflow-wrap: break-word;
}
{
: solid currentColor;
: ;
}
() {
: none;
}
Tailwind Anti-Patterns
<div className="flex flex-col items-center justify-center w-full h-full bg-white dark:bg-gray-900 px-4 py-8 gap-6 border border-gray-200 dark:border-gray-800 rounded-2xl shadow-lg hover:shadow-xl transition-shadow duration-200">
function Card({ children }: { children: ReactNode }) {
return (
<div className="card">
{children}
</div>
);
}
@layer components {
.card {
@apply flex flex-col bg-white dark:bg-gray-900 rounded-2xl border border-gray-200 dark:border-gray-800 p-6 shadow-lg;
}
}
<div className="w-[347px] h-[62px]">
<div className="w-80 h-16"> /* or CSS variable */
<p className="text-gray-600">
<p className="text-muted-foreground"> /* maps to CSS variable */
Typography Scale
:root {
--font-xs: clamp(0.75rem, 0.5vw + 0.65rem, 0.875rem);
--font-sm: clamp(0.875rem, 0.5vw + 0.75rem, 1rem);
--font-base: clamp(1rem, 0.5vw + 0.875rem, 1.125rem);
--font-lg: clamp(1.125rem, 1vw + 0.875rem, 1.375rem);
--font-xl: clamp(1.375rem, 2vw + 0.75rem, 1.875rem);
--font-2xl: clamp(1.875rem, 4vw + 0.5rem, 3rem);
--font-3xl: clamp(2.5rem, 6vw + 0.5rem, 4.5rem);
}
export default {
theme: {
extend: {
fontSize: {
'fluid-sm': 'var(--font-sm)',
'fluid-base': 'var(--font-base)',
'fluid-xl': 'var(--font-xl)',
'fluid-3xl': 'var(--font-3xl)',
}
}
}
}
CSS Containment
.card, .modal, .sidebar {
contain: layout style;
}
.long-list-item {
content-visibility: auto;
contain-intrinsic-size: 0 80px;
}
Common Baseline Failures
| Issue | Symptom | Fix |
|---|
No box-sizing: border-box | Padding blows out widths | Global * { box-sizing: border-box } |
Missing antialiased | Blurry/thick text on Mac | font-smoothing: antialiased |
:focus { outline: none } | Keyboard users lose focus | Use :focus-visible instead |
line-height: normal (browser ~1.2) | Tight, hard-to-read body text | Set line-height: 1.5 on body |
Inline <img> | 4px phantom gap below image | img { display: block } |
overflow-wrap missing | Long words break layout on mobile | Add to all text elements |
Anti-Fake-Pass Rules
Before claiming baseline CSS is done, you MUST show:
Reference: gates/anti-fake-pass-gate.md