CDN (Recommended)
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/gobijan/tachyons5@main/tachyons5.css">Download
curl -O https://raw.githubusercontent.com/gobijan/tachyons5/main/tachyons5.cssThen just use it:
<div class="
p4 bg-slate-gray-3 white br3 box-shadow-border-3 box-shadow-7 f-body flex
items-center justify-center glow o9 active-dim
">
<h1 class="f3 f4-l">@gobijan</h1>
</div>| Feature | Description |
|---|---|
| π¨ CSS Variables | Full theming support with custom properties |
| π Dark Mode | Automatic + manual light/dark theme switching |
| π¦ Zero Build | No npm, no webpack, no PostCSS β just drop it in |
| π± Responsive | Mobile-first with media queries AND container queries |
| π² CSS Grid | Native grid support with cols-* and g* gap utilities |
| π Logical Properties | RTL-ready with start/end instead of left/right |
| π¦ Container Queries | Modern component-based responsive design |
| ποΈ Form Components | Themed inputs, checkboxes, radios, and switches |
| πͺ Dialog & Dropdown | Native <dialog> and Popover API components |
| βΏ Accessibility | Focus rings, reduced motion, selection colors |
| β‘ ~1900+ Utilities | Spacing, typography, colors, flexbox, grid & more |
| πͺΆ ~29kb gzipped | Lightweight and fast |
| π§ Maintained | Actively maintained and updated |
Responsive Card
<article class="mw5 w-100 center bg-white br3 p3 p4-m mb3 ba b--light f-body">
<div class="tc">
<img src="https://placehold.co/400x400/000000/FFF" class="br11 h4 w4 dib ba b--light p2" alt="avatar">
<h1 class="f5 mbe2">Jane Doe</h1>
<h2 class="f3 fw4 gray mbs0">Developer</h2>
</div>
</article>CSS Grid Layout
<div class="grid cols-1 cols-2-m cols-4-l g3">
<div class="p3">Item 1</div>
<div class="p3">Item 2</div>
<div class="p3">Item 3</div>
<div class="p3">Item 4</div>
</div>Container Query Responsive
<div class="container-inline">
<div class="cols-1 cols-2-s cols-4-m">
<!-- Responds to container size, not viewport! -->
</div>
</div>Button Styles
<button class="btn btn--brand">Brand Button</button>
<button class="btn btn--success">Success</button>
<button class="btn btn--error">Error</button>
<button class="btn btn--notice">Notice</button>
<button class="btn btn--outline">Outline</button>
<button class="btn btn--ghost">Ghost</button>| Class | Property | Description |
|---|---|---|
p0 - p9 |
padding | all sides |
m0 - m9 |
margin | all sides |
pis0 - pis9 |
padding-inline-start | start edge (left in LTR) |
pie0 - pie9 |
padding-inline-end | end edge (right in LTR) |
pbs0 - pbs9 |
padding-block-start | top |
pbe0 - pbe9 |
padding-block-end | bottom |
pi0 - pi9 |
padding-inline | left & right |
pb0 - pb9 |
padding-block | top & bottom |
mis0 - mis9 |
margin-inline-start | start edge |
mie0 - mie9 |
margin-inline-end | end edge |
mbs0 - mbs9 |
margin-block-start | top |
mbe0 - mbe9 |
margin-block-end | bottom |
mi0 - mi9 |
margin-inline | left & right |
mb0 - mb9 |
margin-block | top & bottom |
g0 - g7 |
gap | grid/flex gap |
| Class | Description |
|---|---|
f1 - f12 |
Fixed font sizes (0.75rem β 12rem) |
ff1 - ff12 |
Fluid font sizes (scale with viewport) |
ff*-s, ff*-m, ff*-l |
Responsive fluid fonts (container queries) |
fw1 - fw9 |
Font weights |
ts, tc, te, tj |
Text align (start, center, end, justify) |
ttc, ttu, ttl |
Text transform |
lh-solid, lh-title, lh-copy |
Line heights |
| Class | Example |
|---|---|
blue, red, green, yellow... |
Text colors |
bg-blue, bg-red, bg-green... |
Background colors |
b--blue, b--red... |
Border colors |
| Class | Description |
|---|---|
brand, bg-brand, b--brand |
Primary brand color |
text, muted |
Text colors (primary, secondary) |
surface-0 - surface-3 |
Surface/background layers |
error, success, notice |
Semantic status colors |
hover-*, focus-* |
Interactive state variants |
| Class | Property |
|---|---|
start-0, start-1, start-2 |
inset-inline-start |
end-0, end-1, end-2 |
inset-inline-end |
block-start-0, block-start-1 |
inset-block-start (top) |
block-end-0, block-end-1 |
inset-block-end (bottom) |
| Class | Property |
|---|---|
bis |
border-inline-start |
bie |
border-inline-end |
bbs |
border-block-start |
bbe |
border-block-end |
| Class | Property |
|---|---|
fis |
float: inline-start |
fie |
float: inline-end |
fn |
float: none |
| Class | Property |
|---|---|
flex, inline-flex |
display: flex |
grid, inline-grid |
display: grid |
cols-1 - cols-16, cols-24 |
grid-template-columns |
flex-row, flex-column |
flex-direction |
justify-center, justify-between... |
justify-content |
items-center, items-start... |
align-items |
| Class | Description |
|---|---|
shadow-1 |
Subtle shadow for tight UI elements |
shadow-2 |
Light shadow for cards |
shadow-3 |
Medium shadow for dropdowns/popovers |
shadow-4 |
Heavy shadow for modals/dialogs |
inner-shadow-1 - inner-shadow-4 |
Inset shadows with highlight |
A dropdown menu component using the Popover API with CSS anchor positioning and smooth animations.
<div class="dib">
<button popovertarget="dropdown-1"
style="anchor-name: --anchor-1;"
aria-haspopup="menu">
Actions βΎ
</button>
<div id="dropdown-1"
popover
class="dropdown-menu p3 bg-white shadow-3 br4"
style="--anchor: --anchor-1;"
role="menu">
<a href="#" class="db p3 hover-bg-gray-10 br3">Edit</a>
<a href="#" class="db p3 hover-bg-gray-10 br3">Delete</a>
</div>
</div>| Class | Description |
|---|---|
dropdown-menu |
Base dropdown with anchor positioning and animations |
dropdown-menu--end |
Right-align dropdown to anchor |
dropdown-menu--top |
Position dropdown above anchor |
A dialog component using the native <dialog> element with smooth animations.
<dialog class="dialog">
<h2>Modal Title</h2>
<p>Modal content goes here.</p>
<button onclick="this.closest('dialog').close()">Close</button>
</dialog>
<button onclick="document.querySelector('.dialog').showModal()">
Open Modal
</button>| Class | Description |
|---|---|
dialog |
Base dialog with backdrop and animations |
dialog--sm |
Small dialog (max-width: 20rem) |
dialog--lg |
Large dialog (max-width: 48rem) |
dialog--full |
Full-screen dialog |
Themed form elements that respect light/dark mode.
<input type="text" class="input" placeholder="Text input">
<input type="text" class="input input--error" placeholder="Error state">
<input type="checkbox" class="checkbox">
<input type="radio" class="radio" name="group">
<input type="checkbox" class="switch">| Class | Description |
|---|---|
input |
Styled text input |
input--error |
Error state for inputs |
input--success |
Success state for inputs |
checkbox |
Styled checkbox |
radio |
Styled radio button |
switch |
Toggle switch |
Accessible focus styles using :focus-visible.
| Class | Description |
|---|---|
focus-ring |
Brand color focus ring with offset |
focus-ring-inset |
Inset focus ring |
focus-ring-error |
Error color focus ring |
focus-ring-success |
Success color focus ring |
| Class | Description |
|---|---|
scroll-smooth |
Smooth scroll behavior |
scroll-snap-x |
Horizontal scroll snap (mandatory) |
scroll-snap-y |
Vertical scroll snap (mandatory) |
snap-start, snap-center, snap-end |
Snap alignment |
scroll-p1 - scroll-p5 |
Scroll padding |
scrollbar-hidden |
Hide scrollbar |
scrollbar-thin |
Thin scrollbar |
For native form elements (checkboxes, radios, range, progress).
| Class | Description |
|---|---|
accent-brand |
Brand accent color |
accent-error |
Error accent color |
accent-success |
Success accent color |
accent-notice |
Notice accent color |
Automatic vertical rhythm between sibling elements. Inspired by Bulma's .block pattern.
<!-- Default stack spacing -->
<div class="stack">
<p>First paragraph</p>
<p>Second paragraph</p>
<p>Third paragraph (no bottom margin)</p>
</div>
<!-- Tight stack for forms -->
<form class="stack3">
<input type="text" class="input" placeholder="Name">
<input type="email" class="input" placeholder="Email">
<button class="btn btn--brand">Submit</button>
</form>| Class | Spacing |
|---|---|
stack |
Default (--block-spacing, 32px) |
stack1 |
2px |
stack2 |
4px |
stack3 |
8px |
stack4 |
16px |
stack5 |
32px |
stack6 |
64px |
stack7 |
128px |
<div class="skeleton skeleton-avatar"></div>
<div class="skeleton-shimmer skeleton-text"></div>| Class | Description |
|---|---|
skeleton |
Pulsing skeleton animation |
skeleton-shimmer |
Shimmer effect skeleton |
skeleton-text |
Text line placeholder |
skeleton-avatar |
Avatar placeholder (3rem circle) |
skeleton-button |
Button placeholder |
skeleton-circle |
Circular skeleton |
| Class | Description |
|---|---|
text-balance |
Balance text across lines |
text-pretty |
Prevent orphans/widows |
text-nowrap |
No wrapping |
hyphens-auto |
Automatic hyphenation |
break-word |
Break long words |
| Class | Description |
|---|---|
print-hidden |
Hide when printing |
print-only |
Show only when printing |
print-break-before |
Page break before |
print-break-after |
Page break after |
print-plain |
Remove backgrounds/shadows for print |
| Feature | Description |
|---|---|
::selection |
Themed text selection colors |
@media (prefers-reduced-motion) |
Disables animations automatically |
motion-reduce |
Force disable animations on element |
motion-safe |
Override reduced motion preference |
| Class | Property |
|---|---|
container-size |
container-type: size |
container-inline |
container-type: inline-size |
container-normal |
container-type: normal |
-s, -m, -l suffixes |
Respond to container width |
| Suffix | Breakpoint |
|---|---|
| (none) | All screens |
-ns |
Not small (β₯30em) |
-m |
Medium (β₯48em) |
-l |
Large (β₯60em) |
Tachyons 5 uses CSS custom properties for easy theming:
:root {
--blue: #357edd;
--spacing-1: 0.25rem;
--spacing-2: 0.5rem;
/* ... and many more */
}Override them to customize your design system:
:root {
--brand-light: var(--blue-5); /* Change brand color */
--font-family-body: 'Inter', sans-serif;
}Dark mode works automatically via prefers-color-scheme, or manually:
<!-- Automatic (follows system preference) -->
<html>
<!-- Force light mode -->
<html color-scheme="light">
<!-- Force dark mode -->
<html color-scheme="dark">The semantic color tokens (--brand, --text, --surface-*, etc.) automatically switch between light and dark palettes.
Tachyons 5 was originally designed by Adam Morse but the v5 branch remained unreleased for 2 years. After discussing with Adam, I took on maintaining and improving this version.
What's different from Tachyons 4:
- β Full CSS Variables support
- β Semantic theming with automatic dark mode
- β Container Queries for component-based responsive design
- β
CSS Grid utilities (
grid,cols-*) - β
Simplified class names (
p4instead ofpa4) - β CSS Logical Properties for RTL/internationalization support
- β OpenProps-inspired shadow system
- β Dropdown & Dialog components with Popover API
- β Form components (inputs, checkboxes, switches)
- β Accessibility (focus rings, reduced motion, selection)
- β Scroll snap & smooth scrolling utilities
- β Skeleton loading animations
- β Text wrap utilities (balance, pretty)
- β Print styles
- β Modern CSS features (aspect-ratio, gap, accent-color, etc.)
- β No build step required
- β Actively maintained
MIT License β same as the original Tachyons.
Contributions are welcome! Feel free to:
- Open issues for bugs or feature requests
- Submit pull requests
- Reach out for collaboration
Made with β€οΈ by Bijan
Original Tachyons 5 branch by Adam Morse