CSS チートシート
検索・印刷できる CSS のリファレンス — セレクタ、ボックスモデル、flexbox、grid、タイポグラフィ、トランジション、モダンな機能。無料。
Selectors
13.class
Select all elements with the class
#id
Select the element with the id
a, b
Group: select a and b
a b
Descendant: b inside a
a > b
Direct child b of a
a + b
Adjacent sibling immediately after a
a ~ b
General sibling b after a
[type="text"]
Attribute selector
:hover :focus
Pseudo-classes for state
:nth-child(2n)
Every even child
::before ::after
Pseudo-elements (generated content)
:not(.x)
Negation: anything but .x
:is(h1, h2, h3)
Matches any selector in the list
Box model
7box-sizing: border-box;
Include padding & border in width
margin: 0 auto;
Center a block horizontally
padding: 1rem 2rem;
Vertical 1rem, horizontal 2rem
border: 1px solid #ccc;
Width, style, color
border-radius: 8px;
Rounded corners
outline: 2px dashed red;
Outline (does not affect layout)
overflow: hidden;
Clip content that overflows
Flexbox
8display: flex;
Create a flex container
flex-direction: row | column;
Main axis direction
justify-content: space-between;
Align along the main axis
align-items: center;
Align along the cross axis
flex-wrap: wrap;
Allow items to wrap
gap: 1rem;
Space between items
flex: 1;
Grow to fill space (1 1 0)
align-self: flex-end;
Override cross-axis for one item
Grid
8display: grid;
Create a grid container
grid-template-columns: 1fr 1fr 1fr;
Three equal columns
repeat(3, 1fr)
Shorthand for repeated tracks
minmax(200px, 1fr)
Track between a min and max
grid-template-columns: repeat(auto-fill, minmax(200px,1fr));
Responsive auto columns
gap: 1rem;
Row and column gap
grid-column: 1 / 3;
Span from line 1 to 3
place-items: center;
Center items on both axes
Typography
8font-family: system-ui, sans-serif;
Font stack
font-size: 1.125rem;
Relative font size
font-weight: 600;
Bold weight
line-height: 1.6;
Line spacing
letter-spacing: .02em;
Tracking
text-align: center;
Horizontal text alignment
text-transform: uppercase;
Change letter case
text-overflow: ellipsis;
Truncate with … (needs overflow+nowrap)
Colors & background
7color: #1f2937;
Text color
background: rgb(0 0 0 / 50%);
Modern rgb with alpha
background: linear-gradient(90deg,#f06,#48f);
Linear gradient
opacity: .5;
Element transparency
box-shadow: 0 4px 12px rgb(0 0 0 / .15);
Drop shadow
background-size: cover;
Scale image to cover
color-mix(in srgb, red 40%, blue);
Mix two colors
Positioning
6position: relative;
Offset from normal position
position: absolute;
Relative to nearest positioned ancestor
position: fixed;
Relative to the viewport
position: sticky; top: 0;
Sticks when scrolling past
inset: 0;
top/right/bottom/left = 0
z-index: 10;
Stacking order
Transitions & animation
5transition: all .2s ease;
Animate property changes
transform: translateY(-4px) scale(1.05);
Move, scale, rotate
@keyframes spin { to { transform: rotate(360deg); } }
Define an animation
animation: spin 1s linear infinite;
Run a keyframe animation
will-change: transform;
Hint the browser to optimize
Responsive & modern
7@media (max-width: 768px) { ... }
Media query breakpoint
clamp(1rem, 2vw, 2rem)
Fluid value with min/max
aspect-ratio: 16 / 9;
Maintain an aspect ratio
var(--brand)
Use a custom property
:root { --brand: #4f46e5; }
Define a custom property
container-type: inline-size;
Enable container queries
@container (min-width: 400px) {…}
Container query
「:q」に一致する項目はありません。
CSS チートシートについて
このCSSチートシートには、日常的に使うプロパティが1ページの検索可能な形で詰め込まれています。セレクタ、ボックスモデル、フレックスボックス、グリッド、タイポグラフィ、色と背景、位置指定、トランジションとアニメーション、そしてレスポンシブ・モダンCSSのセクションです。
「あのプロパティ名は何だっけ?」という疑問に検索1回で答えられるよう構成されています。特にフレックスボックスとグリッドのセクションでは、そのままスタイルシートにコピーできる整列・レイアウトのプロパティと値を列挙し、モダンなセクションでは新しめの機能もすぐに手が届きます。
このシートは無料で、クライアントサイドで読み込まれ、入力するそばからリアルタイムに絞り込まれ、任意の宣言をワンクリックでコピーできます。固定表示の目次でセクション間を移動でき、印刷ボタンできれいな紙のリファレンスが作れます。
CSS チートシートの使い方
- セレクタ、ボックスモデル、フレックスボックス、グリッド、タイポグラフィなど、セクション一覧にざっと目を通します。
- grid、hover、transitionのようなプロパティや概念を検索ボックスに入力し、全行を絞り込みます。
- 固定表示の目次から位置指定などのセクションへジャンプします。
- スニペットまたはそのコピーアイコンをクリックして、CSS宣言をコピーします。
- デスクサイドのCSSリファレンスとしてシートを印刷します。
よくある質問
9つのセクションです。セレクタ、ボックスモデル、フレックスボックス、グリッド、タイポグラフィ、色と背景、位置指定、トランジションとアニメーション、そしてレスポンシブとモダンCSS機能です。
はい。どちらも専用のセクションがあり、コンテナ・アイテムのプロパティ、整列の値、ショートハンド形式を掲載しています。開発者が最も頻繁に調べる項目です。
はい。長年使われてきた基本機能に加えて、レスポンシブ・モダンCSSの専用セクションが最近のスタイルシートで出会う新しめの機能とメディアクエリのパターンを扱っています。
できます。コードまたはホバー時のコピーアイコンをクリックすると宣言がクリップボードに保存され、「Copied!」という短いメッセージで確認できます。
はい、完全に無料です。ライブ検索ができ、ログイン不要で利用回数の制限もないクライアントサイドのページです。
人気の検索
css cheat sheet
css selectors list
css flexbox properties
css grid properties
css box model reference
css position values
css transition and animation syntax
css properties reference
お困りですか?
このツールで問題が見つかりましたか?チームにお知らせください。