hanging-punctuation
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
hanging-punctuation は CSS のプロパティで、区切り記号をテキストの行頭や行末にぶら下げるべきかどうかを指定します。ぶら下げられる区切り記号は行ボックスの外側に配置されれることがあります。
構文
css
/* キーワード値 */ hanging-punctuation: none; hanging-punctuation: first; hanging-punctuation: last; hanging-punctuation: allow-end; /* 2 つのキーワード */ hanging-punctuation: first allow-end; hanging-punctuation: first last; hanging-punctuation: last allow-end; /* 3 つのキーワード */ hanging-punctuation: first allow-end last; /* グローバル値 */ hanging-punctuation: inherit; hanging-punctuation: initial; hanging-punctuation: revert; hanging-punctuation: revert-layer; hanging-punctuation: unset; hanging-punctuation プロパティは 1 つ、2 つ、3 つの値を空白で区切った値で指定することができます。
値
none-
文字のぶら下げを行いません。
first-
要素の最初の書式設定された行頭にある、開き括弧または引用符をぶら下げます。次のものが適用されます。
last-
要素の最後の書式設定された行末にある、閉じ括弧または引用符をぶら下げます。次のものが適用されます。
allow-end-
句読点をぶら下げないと行末が揃わない場合に、句読点をぶら下げます。
ぶら下げることができる区切り文字や句読点には、次のものがあります。
U+002C, COMMAU+002E, FULL STOPU+060C, ARABIC COMMAU+06D4, ARABIC FULL STOPU+3001, IDEOGRAPHIC COMMAU+3002, IDEOGRAPHIC FULL STOPU+FF0C, FULLWIDTH COMMAU+FF0E, FULLWIDTH FULL STOPU+FE50, SMALL COMMAU+FE51, SMALL IDEOGRAPHIC COMMAU+FE52, SMALL FULL STOPU+FF61, HALFWIDTH IDEOGRAPHIC FULL STOPU+FF64, HALFWIDTH IDEOGRAPHIC COMMA
ユーザーエージェントによってはそれ以外の文字があるかもしれません。
公式定義
| 初期値 | none |
|---|---|
| 適用対象 | すべての要素 |
| 継承 | あり |
| 計算値 | 指定通り |
| アニメーションの種類 | 離散値 |
形式文法
hanging-punctuation =
none |
[ first || [ force-end | allow-end ] || last ]
例
>開始と終了の引用符をぶら下げるよう設定
HTML
html
<p> «For a moment, nothing happened. Then, after a second or so, nothing continued to happen.» </p> <p class="hanging"> «For a moment, nothing happened. Then, after a second or so, nothing continued to happen.» </p> <p class="hanging right"> «For a moment, nothing happened. Then, after a second or so, nothing continued to happen.» </p> CSS
css
p { width: 15em; border: 1px solid #cccccc; font-size: 2rem; font-style: italic; margin: 1em; } p.hanging { hanging-punctuation: first last; } p.right { text-align: right; } 結果
仕様書
| Specification |
|---|
| CSS Text Module Level 3> # hanging-punctuation-property> |