Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

CSSプロパティ対応表

表示・可視性

プロパティ対応備考
display⚠️block/inline/inline-block/list-item/table/table-row/table-cell/table-caption/flex/noneのみ。gridは対応(Grid節)。inline-flex/inline-gridtable-row-group等のテーブル内部値・flow-rootは非対応。<thead>/<tbody>/<tfoot>はUAスタイルでblockのままだが、行収集が透過するのでテーブルとして機能する
visibility⚠️visible/hidden/collapsecollapsehiddenと同一視(テーブル行/列の高さ再計算はしない)。継承プロパティ
overflow⚠️visible以外(hidden/scroll/auto)は区別せず一律クリップ。スクロールバーの概念は無い。overflow-x/overflow-yは非対応
opacity⚠️<number>/<percentage>を0〜1にクランプ。PDFの透明グループ+ExtGStateで実装。要素単位の合成で、mix-blend-mode等のブレンドは非対応
z-index⚠️auto/<integer>position: relativeの要素にのみ効く(仕様では他のpositioned要素にも効く)。同じ親を持つ兄弟間の描画順のみを制御し、スタッキングコンテキストの分離は非対応。絶対配置要素は常に通常フローの上に描かれる
box-sizing⚠️content-box/border-box。標準外のpadding-boxは非対応

ボックスモデル

プロパティ対応備考
width / height⚠️auto/<length>/<percentage>/calc()min-content/max-content/fit-contentは非対応。heightのパーセンテージはcontaining block高さ不定として無視される
min-width / min-height⚠️<length>/<percentage>/calc()(初期値0)。auto/min-content等のキーワードは非対応。min-heightのパーセンテージは無視される
max-width / max-height⚠️none/<length>/<percentage>/calc()(初期値none)。min > maxのときはminが勝つ(仕様通り)。max-heightのパーセンテージは無視される
aspect-ratio⚠️auto | <ratio> | auto <ratio>。「幅確定→高さ導出」が基本で、「高さ確定→幅導出」はfloat/inline-block/絶対配置/<img>のshrink-to-fit文脈のみ(通常フローのブロックのwidth: autoはstretch優先、仕様通り)。min-*/max-*でクランプされて比が崩れた場合の再計算は行わない
margin1〜4値ショートハンド。auto(中央寄せ)・負値に対応
margin-top / -right / -bottom / -left隣接兄弟間・親子間のマージン相殺に対応
padding1〜4値ショートハンド
padding-top / -right / -bottom / -leftパーセンテージはcontaining block幅基準(仕様通り)

枠線・角丸・アウトライン・影

プロパティ対応備考
border<width> || <style> || <color>を任意順・任意省略で受け付け、4辺へ適用
border-top / -right / -bottom / -left辺別ショートハンド(値文法はborderと同じ)
border-width / border-style / border-color1〜4値ショートハンド
border-*-width⚠️<length>のみ。thin/medium/thickキーワードは非対応
border-*-style⚠️none/hidden/solid/dashed/dotted/double/groove/ridge/inset/outsethiddennoneと同一視(テーブルの枠線競合解決でも区別しない)。groove/ridge/inset/outsetborder-colorから2階調の陰影を算出して描画
border-*-color初期値はcurrentcolor
border-radius⚠️1〜4値+/区切りの楕円構文に対応。パーセンテージ指定は非対応(<length>のみ)。4辺の太さ・スタイル・色が揃っていない場合は角丸を諦めて直線4辺へフォールバックする。groove/ridge/inset/outsetとの併用も同様にフォールバック
border-top-left-radiusほか3隅⚠️<length>{1,2}(水平/垂直半径)。制約はborder-radiusと同じ
outline<width> || <style> || <color>。border-boxの外側に描画し、レイアウトには影響しない
outline-width / outline-style / outline-color⚠️outline-styleborder-styleと同じ値集合。UA依存のautoは非対応
outline-offset常に0固定
box-shadow⚠️none | <shadow>#(カンマ区切りで複数指定可、先頭が最前面)。insetはパースするが描画は非対応。ぼかしは4段階の同心矩形による近似

配置(positioning / float / transform)

プロパティ対応備考
floatnone/left/rightwidth: autoのshrink-to-fitに対応
clearnone/left/right/both
position⚠️static/relative/absolute/fixedstickyは非対応。absolute/fixedには後述の制約あり
top / right / bottom / left⚠️absolute/fixedではbottom単独指定による下端揃えが非対応(高さの循環参照を避けるためtop基準に解決する)。relativeではオフセットとして機能する
inset(ショートハンド)個別のtop/right/bottom/leftを使う
transform⚠️translate/translateX/translateY/scale/scaleX/scaleY/rotate/skew/skewX/skewY/matrix。3D系(translate3d/rotate3d/perspective()等)は非対応。PDFのCTM変換で実装するため、変換後の内容はページ分割の判定に影響しない
transform-origin⚠️background-positionと同じ値文法(キーワード/長さ/パーセンテージの1〜2値)。初期値50% 50%。3値目(Z軸)は非対応

position: absolute/fixedの既知の制約:

  • 絶対配置要素は「通常フローから外し、確定したページへ後付けするオーバーレイ」として配置する
  • containing blockになれるのは、単一ページに収まっているpositioned祖先(またはページ領域)
  • インラインフォーマッティングコンテキストの内側(テキストの途中)にあるabsolute、テーブルセル内・flexアイテム内のabsoluteは非対応
  • 絶対配置要素自身がページを跨ぐ分割は非対応(1ページにbest-effortで置く)
  • ストリーミングモード(Mode::Streaming)では絶対配置を無視する

フォント・テキスト

プロパティ対応備考
font-family⚠️カンマ区切りリスト。汎用family名はserif/sans-serif/monospaceをシステムフォントから解決する(cursive/fantasyは解決しない)。sans-serifの解決先はCLIの--gothic-fontで決定的に上書きできる
font-size⚠️<length>(px/em/rem)のみ。smaller/larger/medium等のキーワード、パーセンテージ指定は非対応
font-weight⚠️normal/bold/100900。数値は600以上をboldとみなす2値化。太字フォントが無い場合は塗り+縁取りの疑似ボールドで描画
font-style⚠️normal/italic/oblique(obliqueitalicと同一視、傾斜角の指定は不可)。イタリック字形が無い場合はテキスト行列のせん断による疑似イタリック
font(ショートハンド)個別のロングハンドを使う
color継承プロパティ。指定できる色の記法はセレクタ・値・at-ruleを参照
line-heightnormal/<number>/<length>/<percentage>
text-align⚠️left/right/center/justifyjustifyは最終行以外の単語間で余白を配分する。start/endは非対応(direction自体が非対応のため)
text-indent⚠️<length>/<percentage>hanging/each-lineは非対応
text-transform⚠️none/uppercase/lowercase/capitalize(語頭のみ変換)。full-width/full-size-kanaは非対応
text-decoration / text-decoration-line⚠️none/underline/line-through(併記可)。overline/blinkは非対応。ショートハンドのtext-decoration-color/-style/-thickness部分も非対応。祖先から子孫への伝播は「継承プロパティとして扱う」簡略実装
text-shadow⚠️none | <shadow>#(<offset-x> <offset-y> <blur>? <color>?)。PDFにぼかしフィルタが無いため、blurはアルファを下げた多重描画による近似。継承プロパティ
text-overflow⚠️clip/ellipsisoverflowvisible以外のときのみ有効。幅方向にはみ出した行のみが対象(ブロック全体のオーバーフローは扱わない)。<string>指定は非対応
word-breaknormal(CJK文字が隣接する境界のみ改行可)/break-all/keep-all。非推奨値break-wordは非対応
overflow-wrap / word-wrap⚠️normal/break-word/anywhere(anywherebreak-wordと同一視)。改行機会は増やさず、行頭に置いても収まらない語だけを文字単位で割る
hyphens⚠️none/manual/auto。soft hyphen(U+00AD)でのみ分割し、分割時に行末へハイフンを表示する。autoは辞書を持たないためmanualと同じ挙動(自動ハイフネーションはしない)
text-emphasis / -style / -color / -position⚠️dot/circle/double-circle/triangle/sesame(filled/open)と<string>。キーワードのマークはPDFのパスで描くためフォントの字形に依存しない(<string>はグリフ描画で、字形が無ければ描かれない)。positionover/underのみ(right/leftは読み飛ばし)。マーク分だけ行の高さが広がる。句読点をスキップするtext-emphasis-skipは非対応
letter-spacing⚠️normal/<length>。パーセンテージは非対応
word-spacing⚠️normal/<length>
white-space⚠️normal/nowrap/prepre-wrap/pre-line/break-spacesは非対応
vertical-alignbaseline/sub/super/text-top/text-bottom/top/middle/bottom/<length>/<percentage>。テーブルセル文脈ではtop/middle/bottom(とbaseline)が意味を持つ
quotes⚠️noneまたは"開き" "閉じ"のペアの繰り返し。contentopen-quote/close-quoteと組で使う。継承プロパティ

背景

プロパティ対応備考
background(ショートハンド)⚠️<color>/<image>/<repeat>/<attachment>/<position>[ / <size>]を任意順で受け付ける。指定しなかったロングハンドは仕様通り初期値へリセットされる。background-clip/-origin(padding-box等のキーワード)を含むとパースエラーになり宣言ごと無視される点に注意
background-colorアルファ付きの色はExtGStateで透過描画
background-image⚠️none | url(...)のみ。linear-gradient()等のグラデーション関数、カンマ区切りの複数背景は非対応。既定ではintrinsicサイズでタイル配置
background-positionキーワード(left/center/right/top/bottom)と長さ/パーセンテージの1〜2値。3〜4値構文(right 10px bottom 20px)は非対応
background-sizecover/contain/<length-percentage> | autoの1〜2値
background-repeat⚠️repeat/repeat-x/repeat-y/no-repeat。CSS3のround/space、2値構文は非対応
background-attachment⚠️scroll/fixed(スクロールの概念が無いためfixedscrollと同一視)
background-clip / background-origin / background-blend-mode未実装。背景はborder-box基準で描画する

border-radiusbackground-imageを併用した場合、角丸によるクリップは行わない(角丸は背景色の塗りにのみ効く)。

テーブル

プロパティ対応備考
table-layoutauto/fixedautoではセル内容の自然幅を測って列幅を決める(ネストしたテーブル・flexの自然幅測定のみ非対応で0扱い)
border-collapse⚠️separate/collapsecollapseは見た目の枠線統合のみを行う(CSS2.1 §17.6.2の競合解決を「太い方が勝ち、同幅ならスタイル優先順」で簡略化)。継承プロパティ
border-spacing<length>{1,2}border-collapse: collapse時は0として扱う。継承プロパティ
caption-side⚠️top/bottom。縦書き向けのleft/rightは非対応
empty-cellsshow/hideborder-collapse: separateでのみ意味を持つ。継承プロパティ
vertical-align(セル)上記フォント・テキストを参照

<colgroup>/<col>width属性・CSSwidthによる列幅指定、rowspan/colspan<thead>のページまたぎ繰り返しに対応。 rowspan="0"は1として扱う。

セルのmin-width/max-widthは列幅アルゴリズムに反映される。 table-layout: autoでは列の自然幅をクランプする形で効くため、表を紙幅に収める比例縮尺の後はmin-widthが保証されない。 table-layout: fixedでは1行目のセルの指定幅をクランプし、width: autoかつmin-widthのみの指定はその値を列幅として使う。

リスト

プロパティ対応備考
list-style(ショートハンド)type/position/imageを任意順・任意省略で受け付ける
list-style-type⚠️disc/circle/square/decimal/decimal-leading-zero/lower-roman/upper-roman/lower-alpha(lower-latin)/upper-alpha(upper-latin)/nonecjk-*/hiragana/katakana等は非対応。継承プロパティ
list-style-positionoutside/inside。継承プロパティ
list-style-image⚠️none | url(...)をパースするが描画には使わない(常にlist-style-typeのテキストマーカーへフォールバック)

生成コンテンツ・カウンタ

プロパティ対応備考
content⚠️::before/::after/::first-letterおよび@pageのmargin box用。文字列リテラル・attr()counter()/counters()open-quote/close-quote/no-open-quote/no-close-quoteの連結に対応。url()による画像挿入は非対応。ブロック子を持つ要素の::before/::afterは生成されない(簡略化)
counter-resetnoneまたはname [<integer>]の繰り返し
counter-incrementnoneまたはname [<integer>]の繰り返し(値省略時は1)
counter-set未実装

counter(page)/counter(pages)によるページ番号は@pageのmargin box内で使える(counter(pages)はストリーミングモードでは総ページ数が確定しないためエラーになる)。

ページ分割(CSS Fragmentation)

プロパティ対応備考
break-before / break-after⚠️auto/avoid(avoid-page/avoid-columnも同義)/always(pageも同義)。left/right/recto/verso(見開き制御)、多段組み関連の値は非対応
break-inside⚠️auto/avoid(avoid-page/avoid-columnも同義)
page-break-before / page-break-after / page-break-inside上記break-*のエイリアス(wkhtmltopdf/wicked_pdf資産からの移行用)
orphans / widows1以上の整数。初期値2
page(名前付きページ)@page introのような名前付きページ自体が非対応

HTML属性data-page-break="before|after|avoid"によるシンタックスシュガーも利用できる。

Flexbox

display: flexのレイアウトはtaffyへ委譲する。 flexコンテナはページ分割上アトミック(display: tableと同じく途中で分割されない)。

プロパティ対応備考
flex-directionrow/row-reverse/column/column-reverse
flex-wrapnowrap/wrap/wrap-reverse
justify-content⚠️flex-start(start)/flex-end(end)/center/space-between/space-around/space-evenlysafe/unsafeオーバーフローキーワードは非対応
align-itemsflex-start(start)/flex-end(end)/center/baseline/stretch
align-contentflex-start(start)/flex-end(end)/center/stretch/space-between/space-around/space-evenly
align-selfauto/flex-start(start)/flex-end(end)/center/baseline/stretch
flex-grow / flex-shrink非負の<number>(負値は無効な宣言として無視)
flex-basis⚠️auto/content/<length-percentage>contentautoと同一視
flex(ショートハンド)noneおよび<grow> [<shrink>] [<basis>]。CSS仕様の既定値規則(flex: 1のbasisは0%flex: <width>のgrow/shrinkは1)を再現
gap / row-gap / column-gap⚠️flexコンテナでのみ有効(多段組みのcolumn-gapとしては機能しない)
ordertaffy 0.12系が未対応のため
place-content / place-items / place-self(ショートハンド)未実装。個別のロングハンドを使う
justify-items / justify-selfflexアイテムには適用されない(下記)

justify-items/justify-selfがflexで効かないのは仕様

CSS Box Alignmentではjustify-items/justify-selfはGrid・ブロックレイアウト用のプロパティで、flexアイテムには適用されない(主軸方向のアイテム個別の配置はjustify-contentmargin: autoで表現する、という設計)。 ブラウザも無視する。 レイアウトを委譲しているtaffyでも、これらを参照するのはGridのアルゴリズムだけで、flexboxのアルゴリズムは一切参照しない。

したがってこのエンジンでパースに対応しても見た目は変わらないため、意図的に実装していない。 flexで特定のアイテムだけを寄せたい場合はmargin: autoを使う(こちらは対応済み):

.item { margin-left: auto; }            /* justify-self: end 相当(主軸の終端へ) */
.item { margin-left: auto; margin-right: auto; }  /* justify-self: center 相当 */

Grid

display: gridのレイアウトはFlexboxと同じくtaffyへ委譲する。 Flexboxと違い、1ページに収まらないグリッドは行単位でページ分割される(テーブルと同じ方針。複数行にまたがるアイテムがある境界では分割しない)。

プロパティ対応備考
grid-template-columns / grid-template-rowsnone/<length>/<percentage>/fr/auto/min-content/max-content/minmax()/fit-content()/repeat(<整数>|auto-fill|auto-fit)/[name](ライン名)。トラックサイズにcalc()は非対応
grid-template-areas文字列マトリクス。列数の不一致・非矩形のエリアは不正な値として宣言ごと無視する(仕様通り)。.は名前なしセル
grid-auto-columns / grid-auto-rows<track-size>+
grid-auto-flowrow/column/dense(併記可)
grid-row-start / -end / grid-column-start / -endauto/<integer>/span <integer>/<custom-ident>/span <custom-ident>
grid-row / grid-column / grid-area/区切りのショートハンド。grid-area: <name>で名前付きエリアを指定できる
justify-items / justify-selfGridでのみ意味を持つ(flexアイテムには適用されない、上記)
align-items / align-self / justify-content / align-content / gapFlexboxと共有(値の範囲はFlexbox節を参照)
grid / grid-template(ショートハンド)個別のロングハンドを使う。トラック定義とエリア定義を1つの構文へ詰め込む複雑な文法のため非対応
display: inline-gridinline-flexと同じ理由で非対応
subgrid / masonry未実装

置換要素(画像)

プロパティ対応備考
object-fitfill/contain/cover/none/scale-down<img>にのみ意味を持つ
object-positionbackground-positionと同じ値文法。初期値50% 50%

<img>はインライン配置・width/height属性/CSSによるサイズ指定に対応。 対応フォーマットはPNG/JPEG/WebP。 CSSでwidth/heightの片方だけを指定した場合は内在アスペクト比でもう一方を導出する(aspect-ratio、)。

非対応プロパティ一覧

以下は宣言ごと無視される(パースエラー)。 実装が無いだけで、意図的に永久除外と決めたものだけではない。 カテゴリ表の行も参照。

  • ショートハンド: font/inset/place-content/place-items/place-self/text-decorationの色・線種部分
  • 論理プロパティ: inline-size/block-size/margin-inline/padding-block/border-inline等すべて
  • 書字方向: direction/unicode-bidi/writing-mode/text-orientation/text-combine-upright
  • テキスト詳細: text-decoration-color/-style/-thickness/text-underline-offset/text-emphasis-skip/tab-size/ruby-*/text-justify/line-break
  • フォント詳細: font-variant/font-stretch/font-feature-settings/font-variation-settings/font-kerning/font-display
  • 多段組み: columns/column-count/column-width/column-rule/column-span/column-fill
  • 視覚効果: filter/backdrop-filter/mix-blend-mode/background-blend-mode/clip/clip-path/mask/isolation
  • 3D/アニメーション: perspective/transform-style/backface-visibility/translate/rotate/scale(個別プロパティ版)/transition-*/animation-*/will-change
  • 枠線・背景の拡張: border-image-*/background-clip/background-origin/outline-offset
  • オーバーフロー: overflow-x/overflow-y/resize/scroll-*/overscroll-behavior
  • UI/対話: cursor/pointer-events/user-select/caret-color/accent-color/appearance
  • その他: all/content-visibility/counter-set/page(名前付きページ)/speak等の音声メディア系/zoom