Skip to content
AliasCSS Logo
v1.5.6
Docs / Cheat sheet

Cheat sheet

The grammar, the common aliases, scopes and selectors on one page.

Shape of a class

[@scope-][selector-]property-value

d-flex                     display: flex
@md-p-24px                 from 768px
--hover-c-red              :hover
@md--hover-c-red           both
[aria-current=page]-fw-600 attribute
_li-c-red                  descendant li
[data-open]&o-1            ancestor with data-open
@md[d-flex,g-16px]         group
[p-16px,br-8px]--as-card   export as .card

Values

b-1px-solid-red            spaces become -
m--8px                     negative: --
o-0.5                      decimal
c-red/0.5                  alpha 0–1
c-red--imp                 !important (--important also works)
padding(8px_16px)          function form: _ is a space
w(calc(100%_-_32px))       + and - need spaces inside calc
tf-rotate-3deg__scale-1.1  chain list values with __
--x-gap:16px               define a variable
g--x-gap:16px              use it, with a fallback

Common aliases

Alias Property Alias Property
d display c color
p px py padding bgc background-color
m mx my margin fs font-size
w h width, height fw font-weight
mw xw min-, max-width lh line-height
xh max-height ff font-family
g gap les letter-spacing
aic align-items: center ta text-align
jcc jcsb justify-content td text-decoration
gtc grid-template-columns b border
gc gr grid-column, grid-row br border-radius
t r btm l top, right, bottom, left o opacity
zi z-index tf transform
cont content: “”

Any full property name works too.

Scopes

Scope Meaning
@xs- below 576px
@sm- @md- @lg- @xl- @xxl- from 576, 768, 992, 1200, 1408px
@container-md- … container queries
@dark- @print- color scheme, print
@hover-capable- @motion-reduce- hover devices, reduced motion
@reset- @base- @theme- @components- @utils- cascade layers
@starting-style- entry styles

Selectors

Write Selector
--hover- --focus-visible- --active- --disabled- states
--before- --after- --placeholder- --marker- pseudo-elements
--hover--before- :hover::before (state first)
--nth-child(2n+1)- --not(--first-child)- --has(--checked)- functional
[data-open]- [aria-expanded=true]- attributes, no quotes
_li- __li- ___p- ____p- descendant, child, next, later sibling
_.(card-title)- descendant class with a dash
[data-open]& _.dark& ancestor

Theme

<html class="x-theme --accentColor:6366f1">

Tokens: slateTheme1–12 (and other Radix scales), accentRATheme100–1600, blackA1–12. Force a part of the page with x-theme-dark or x-theme-light.

Keyframes

<i class="d-none" keyframes-pop="@0-[o-0,tf-scale-0.9] @100-[o-1,tf-none]"></i>
<i class="d-none" keyframes-shake="@[0,100][tf-none] @[25,75][tf-translateX--4px]"></i>
<div class="animation(pop_.3s_ease-out_both)"></div>