CSS辞書

CSS⇄Tailwind対応表

CSSプロパティとTailwindユーティリティクラスの対応を引ける一覧です(Tailwind v4基準・全119項目)。プロパティ名から辞書の解説ページに飛べます。 hover:などのバリアント対応は末尾にまとめています。

レイアウト・配置

blockinline-blockinlinehidden

flex / grid は display-flex・display-grid の項を参照。「hidden」がdisplay: noneに当たる点に注意(visibility: hiddenではない)。

flexinline-flex
gridinline-grid
orderorder-{n}
order-1order-firstorder-lastorder-[13]
@container

名前付きコンテナは @container/{name}。問い合わせる子側は @sm: / @md: などのコンテナバリアントを使う(container-queriesの項を参照)。

grid-cols-subgridgrid-rows-subgrid
aspect-squareaspect-videoaspect-autoaspect-[4/3]
place-items-centerplace-items-startplace-items-stretch
place-content-centerplace-content-between
flex-rowflex-colflex-row-reverseflex-col-reverse
justify-startjustify-centerjustify-betweenjustify-end

safe対応はjustify-center-safe(v4.1+)。

justify-items-startjustify-items-centerjustify-items-stretch
items-startitems-centeritems-enditems-baselineitems-stretch
content-startcontent-centercontent-between
flex-wrapflex-nowrapflex-wrap-reverse
flex-1flex-autoflex-nonegrowshrink-0basis-1/2

「画像が潰れる」対策の flex-shrink: 0 は shrink-0。

grid-cols-3grid-cols-nonegrid-cols-[200px_1fr]
grid-cols-[repeat(auto-fit,minmax(120px,1fr))]

auto-fit / auto-fill 専用のユーティリティは無く、任意値で書く。頻出ならテーマにカスタム登録する。

staticrelativeabsolutefixedsticky
z-indexz-{n}
z-10z-50z-auto-z-10z-[999]
overflow-hiddenoverflow-x-autooverflow-y-scrolloverflow-clip
insetinset-{n} / top-{n} / bottom-{n}(n×4px)
inset-0inset-x-0top-0-top-4inset-[10%]
self-startself-centerself-endself-stretch
justify-self-startjustify-self-centerjustify-self-stretch
grid-columncol-span-{n} / col-start-{n}
col-span-2col-span-fullcol-start-2
grid-rowrow-span-{n} / row-start-{n}
row-span-2row-span-fullrow-start-1
position: stickysticky + top-{n}(top等の指定が必須)

クラス自体は position の項の sticky。効かないときは祖先の overflow を疑う。

Logical Propertiesms-* / me-*(margin-inline-start/end)、ps-* / pe-*、start-* / end-*

v4は物理系ユーティリティ(mx-*等)の実体も論理プロパティ(margin-inline)で出力される。RTL対応はms-*/me-*を選ぶ。

inset-inlinestart-{n} / end-{n}
start-0end-0

スペーシング・サイズ

gapgap-{n}(n×4px。gap-4 = 16px)
gap-2gap-4gap-[18px]

行・列を別々に指定するときは gap-x-{n} / gap-y-{n}。

paddingp-{n}(n×4px。p-4 = 16px)
p-4px-4py-2pt-2p-[18px]

論理プロパティ版は ps-{n}(padding-inline-start)/ pe-{n}(padding-inline-end)。

marginm-{n}(n×4px。負の値は -m-{n})
m-4mx-automt-2-mt-2m-[18px]
widthw-{n}(n×4px)
w-fullw-1/2w-fitw-4w-[52px]
heighth-{n}(n×4px)
h-fullh-screenh-dvhh-4h-[52px]

モバイルのアドレスバー対策には h-dvh / h-svh / h-lvh。

max-widthmax-w-{size}(xs〜7xl)
max-w-mdmax-w-fullmax-w-nonemax-w-[720px]
min-w-0min-w-fullmin-w-fit

flexアイテムで省略(…)が効かないときの min-w-0 が頻出。

box-borderbox-content

Preflight(リセットCSS)が全要素をborder-boxにするため、通常は書かない。

scroll-marginscroll-m{t|b|s|e}-{n}(n×4px)
scroll-mt-14scroll-mt-[56px]
margin-inlinemx-{n} / ms-{n} / me-{n}
mx-4ms-4me-4
padding-inlinepx-{n} / ps-{n} / pe-{n}
ps-4pe-4

px-* の実体はv4では padding-inline。

その他

CSS変数 (--property)bg-(--brand-color) のように (--変数名) でCSS変数を参照(v4)
[--gap:1rem](任意のカスタムプロパティを定義)

v3の bg-[var(--brand)] 記法はv4で (--brand) に短縮された。テーマ変数は @theme で定義する。

will-change-transformwill-change-autowill-change-[top,left]
[contain:layout_paint]

専用ユーティリティは無く任意値で書く。コンテナクエリ用途なら @container(container-typeの項)。

table-fixedtable-auto
scheme-lightscheme-darkscheme-light-dark

scheme-* はv4新設。フォーム部品やスクロールバーの配色をOSテーマに追従させる。

@layer@layer theme, base, components, utilities(v4の内部構造)

v4自体がカスケードレイヤーの上に構築されている。自作CSSは @layer components 等に入れると詳細度の衝突を避けられる。

アニメーション・エフェクト

backdrop-filterbackdrop-{filter}-{amount}
backdrop-blur-smbackdrop-brightness-50backdrop-blur-[2px]

v4でスケール名が変更: v3のbackdrop-blur→backdrop-blur-sm等(blurのリネームに追従)。

filter{filter}-{amount}(併記で複数フィルタを合成)
blur-smgrayscalebrightness-75blur-[2px]

v4でスケール名が変更: v3のblur→blur-sm、blur-sm→blur-xsに改名。

opacityopacity-{n}(0〜100)
opacity-50opacity-0opacity-[0.85]

色だけ半透明にするなら bg-red-500/50 のような透明度修飾の方が適切。

transitionduration-{n}ms / ease-out / delay-{n}ms と組み合わせる
transitiontransition-colorstransition-none

所要時間の既定は150ms。v4ではtransition-behavior: allow-discreteを含む。

transformscale-{n} / rotate-{deg} / translate-{x|y}-{n}
scale-105rotate-45translate-x-4-translate-y-2translate-x-[5px]

v4は個別プロパティ(scale/rotate/translate)で出力される。v3のようなtransformクラスの前置は不要。

animate-spinanimate-pulseanimate-bounceanimate-noneanimate-[wiggle_1s_ease-in-out_infinite]

motion-reduce:animate-none の併記を推奨(prefers-reduced-motionの項を参照)。

@keyframes@theme { --animate-{name}: ...; @keyframes {name} { ... } } で登録

キーフレーム自体のユーティリティは無い。v4ではCSSの@theme内に定義すると animate-{name} が自動生成される。

[view-transition-name:card]

専用ユーティリティは無く任意値で書く。

[animation-timeline:scroll()]

専用ユーティリティは無く任意値で書く。スクロール駆動アニメーション用。

[interpolate-size:allow-keywords]

専用ユーティリティは無く任意値で書く。height: auto へのアニメーションに必要。

背景・装飾

object-coverobject-containobject-fillobject-scale-down
background-colorbg-{color}-{shade}(/nで透明度)
bg-whitebg-red-500bg-transparentbg-[#fdfaf3]
bg-nonebg-[url('/paper.png')]

グラデーションは bg-linear-* / bg-radial / bg-conic(linear-gradientの項を参照)。

bg-coverbg-containbg-autobg-[length:200px_100px]
bg-centerbg-topbg-leftbg-[position:20%_80%]
border色は border-{color}-{shade}
borderborder-2border-tborder-dashed

v4では border の既定色がcurrentColorに変更された(v3はgray-200)。色の明示を推奨。

rounded-smrounded-mdrounded-lgrounded-fullrounded-[10px]

v4でスケール名が変更: v3のrounded→rounded-sm、rounded-sm→rounded-xsに改名。角ごとの指定は rounded-t-* / rounded-tl-* など。

shadow-smshadow-mdshadow-lginset-shadow-smshadow-[0_4px_12px_rgb(0_0_0_/_0.25)]

v4でスケール名が変更: v3のshadow→shadow-sm、shadow-sm→shadow-xsに改名。インセット影のinset-shadow-*はv4新設。

accent-coloraccent-{color}-{shade}
accent-pink-500
list-nonelist-disclist-decimallist-inside
[clip-path:polygon(50%_0,100%_100%,0_100%)]

専用ユーティリティは無く任意値で書く。マスクは mask-* ユーティリティ(v4新設)がある。

object-centerobject-topobject-[25%_75%]
mix-blend-modemix-blend-{mode}
mix-blend-multiplymix-blend-screen
background-blend-modebg-blend-{mode}
bg-blend-multiplybg-blend-overlay
isolateisolation-auto
appearance-noneappearance-auto
outline-2outline-offset-2outline-hiddenoutline-none

v4で旧outline-noneはoutline-hiddenに改名。新しいoutline-noneは本当にoutlineを消すので、フォーカスリングの代替を必ず用意する。

テキスト・フォント

colortext-{color}-{shade}(/nで透明度)
text-gray-900text-whitetext-red-500/50text-[#b0413e]

v4の標準パレットはOKLCHで定義されている。

font-sizetext-{size}(xs〜9xl)
text-smtext-basetext-xltext-[15px]

text-sm/6 のように「サイズ/行の高さ」を同時指定できる。

font-weightfont-{weight}
font-normalfont-semiboldfont-boldfont-[350]
line-heightleading-{n}(n×4px)
leading-noneleading-tightleading-relaxedleading-6leading-[1.8]
tracking-tighttracking-normaltracking-widetracking-[0.2em]
text-lefttext-centertext-righttext-justify

書字方向対応の論理値は text-start / text-end。

underlineline-throughno-underline

線の色・太さ・スタイルは decoration-{color} / decoration-2 / decoration-wavy。

whitespace-nowrapwhitespace-prewhitespace-pre-wrap
truncatetext-ellipsistext-clip

1行省略は truncate 1つで3点セットが揃う。

break-allbreak-keep

英単語の折り返しなら word-break ではなく break-words(overflow-wrap)が先。

[writing-mode:vertical-rl]

専用ユーティリティは無く任意値で書く。縦書きは論理プロパティ(ms-*/ps-*等)との併用が前提。

caret-colorcaret-{color}-{shade}
caret-pink-500
align-middlealign-topalign-baseline
uppercaselowercasecapitalizenormal-case
text-balancetext-prettytext-nowrap
break-wordswrap-anywhere

wrap-anywhere / wrap-break-word はv4.1新設。

レスポンシブ・関数

linear-gradient()from-{color} via-{color} to-{color} で色を指定
bg-linear-to-rbg-linear-65

v4で bg-gradient-* から bg-linear-* に改名。補間色空間も指定可(bg-linear-to-r/oklch)。

radial-gradient()from-{color} / to-{color} で色を指定
bg-radialbg-radial-[at_25%_25%]

bg-radial / bg-conic はv4新設。v3にはユーティリティが無かった。

color-mix()bg-red-500/50 などの透明度修飾(内部でcolor-mix()が使われる)

color-mix()を直接書くユーティリティは無いが、v4の/50透明度記法やcurrentColor混色の実体はcolor-mix()。

[color:light-dark(#1a1712,#fdfaf3)]

専用ユーティリティは無い。Tailwindではdark:バリアントで書き分けるのが慣例(scheme-*の指定が前提)。

bg-[oklch(0.65_0.2_25)]

v4の標準パレット自体がOKLCHで定義されている。任意値でもoklch()をそのまま使える。

インタラクション・UX

cursorcursor-{keyword}
cursor-pointercursor-not-allowedcursor-help
visibleinvisiblecollapse

invisible は visibility: hidden(領域は残る)。display: none は hidden(displayの項)。

select-noneselect-textselect-all
pointer-events-nonepointer-events-auto
[content-visibility:auto]

専用ユーティリティは無く任意値で書く。

scroll-smoothscroll-auto

motion-reduce:scroll-auto の併記を推奨。

snap-xsnap-mandatorysnap-proximity

snap-x snap-mandatory のように2つ重ねて使う。

snap-startsnap-centersnap-align-none
overscroll-containoverscroll-none
resizeresize-yresize-none
scroll-snap親に snap-x snap-mandatory、子に snap-start / snap-center

構成要素は scroll-snap-type / scroll-snap-align の項を参照。

field-sizing-contentfield-sizing-fixed

v4新設。入力に合わせて伸びるtextarea(UIレシピ集に実装例あり)。

バリアント対応(疑似クラス・メディア特性)

@container@sm: / @md: / @lg:

@sm:flex-row @container (min-width: 24rem) { flex-direction: row }

親に @container を指定した上で使う。ビューポート基準の sm: とは別物。任意幅は @min-[420px]:。

@mediasm: / md: / lg: / xl:

md:grid-cols-2 @media (min-width: 48rem) { grid-template-columns: repeat(2, ...) }

モバイルファースト(min-width基準)。上限側は max-md:、任意幅は min-[420px]:。

:hoverhover:

hover:bg-red-700 :hover { background-color: ... }

v4のhover:は「ホバー可能なデバイス」でのみ有効(@media (hover: hover)内)。タッチデバイスでの疑似ホバー問題が仕様レベルで解決された。

:nth-child()odd: / even: / nth-{n}:

odd:bg-gray-50 :nth-child(odd) { background-color: ... }

nth-3: や nth-[3n+1]: のような指定もv4で可能。

:nth-of-type()nth-of-type-{n}:

first-of-type: / last-of-type: もある。

:first-childfirst: / last: / only:

first:border-t-0 :first-child { border-top-width: 0 }

:focus-visiblefocus-visible:

focus-visible:outline-2 :focus-visible { outline-width: 2px }

単なるfocus:よりfocus-visible:推奨(マウスクリックではリングを出さない)。

dark:bg-gray-900 @media (prefers-color-scheme: dark) { background-color: ... }

v4のdark:は既定でprefers-color-scheme連動。クラス切り替え式(.darkを親に付ける)にするには@custom-variantで上書きする。

motion-reduce:animate-none @media (prefers-reduced-motion: reduce) { animation: none }

逆条件(動きを減らす設定がOFFのときだけ動かす)は motion-safe:。

:has()has-[...]: / has-checked:

has-checked:bg-red-50 :has(:checked) { background-color: ... }

group-has-* で「親のhas状態」も参照できる。

starting:opacity-0 @starting-style { opacity: 0 }

v4新設。表示された瞬間からのエントリーアニメーションに使う。

:user-valid / :user-invaliduser-valid: / user-invalid:

user-invalid:border-red-500 :user-invalid { border-color: ... }

v4新設のバリアント。invalid: と違い入力後にのみ発火する。

:focus-withinfocus-within:

focus-within:border-red-400 :focus-within { border-color: ... }