<custom-ident>
<custom-ident>
は CSS のデータ型で、識別子として使われるユーザー定義の任意の文字列を意味します。これは大文字と小文字を区別し、曖昧さを避けるため、いくつかの値は様々なコンテキストで禁止されています。
構文
<custom-ident>
の構文は CSS の識別子 (プロパティ名など) に似ていますが、大文字と小文字を区別する点が違います。これは次の文字から成る文字の並びです:
- 任意のアルファベット (
A
-Z
,a
-z
) - 任意の数字 (
0
-9
) - ハイフン (
-
) - アンダースコア (
_
) - エスケープ文字 (バックスラッシュ
\
に続く) - Unicode 文字 (バックスラッシュ
\
と、それに続く 1 - 6 個の16進値の形式をとる、Unicode コードポイント)
このデータ値は大文字と小文字を区別するため、id1
、Id1
、iD1
、ID1
はすべて異なった識別子です。逆に、別のエスケープ方式を使っていますが、 toto\?
と toto\3F
は同じ識別子です。
禁止されている値
<custom-ident>
を引用符または二重引用符の間に置いてはいけません。こうすると、 <string>
として識別されてしまいます。さらに、先頭の文字は、数字やハイフン (-
) および、それら続くものであってはなりません。
曖昧さを避けるため、 <custom-ident>
を使用する各プロパティは、特定の値の使用を禁止しています:
animation-name
- グローバル CSS 値 (
unset
、initial
、そしてinherit
) を禁止し、none
も禁止しています。 counter-reset
counter-increment
- グローバル CSS 値 (
unset
、initial
、そしてinherit
) を禁止し、none
も禁止しています。 @counter-style
list-style-type
- グローバル CSS 値 (
unset
、initial
、そしてinherit
) およびnone
、inline
、そしてoutside
の値を禁止しています。また、かなりの数の定義済みの値が様々なブラウザーに実装されています:disc
,circle
,square
,decimal
,cjk-decimal
,decimal-leading-zero
,lower-roman
,upper-roman
,lower-greek
,lower-alpha
,lower-latin
,upper-alpha
,upper-latin
,arabic-indic
,armenian
,bengali
,cambodian
,cjk-earthly-branch
,cjk-heavenly-stem
,cjk-ideographic
,devanagari
,ethiopic-numeric
,georgian
,gujarati
,gurmukhi
,hebrew
,hiragana
,hiragana-iroha
,japanese-formal
,japanese-informal
,kannada
,katakana
,katakana-iroha
,khmer
,korean-hangul-formal
,korean-hanja-formal
,korean-hanja-informal
,lao
,lower-armenian
,malayalam
,mongolian
,myanmar
,oriya
,persian
,simp-chinese-formal
,simp-chinese-informal
,tamil
,telugu
,thai
,tibetan
,trad-chinese-formal
,trad-chinese-informal
,upper-armenian
,disclosure-open
, anddisclosure-close
. grid-row-start
grid-row-end
grid-column-start
grid-column-end
span
値を禁止しています。will-change
- グローバル CSS 値 (
unset
、initial
、そしてinherit
) およびwill-change
、auto
、scroll-position
そしてcontents
の値を禁止しています。
例
有効な識別子
nono79 アルファベットと数字の組み合わせ ground-level アルファベットとダッシュの組み合わせ -test ダッシュとそれに続くアルファベット _internal アンダースコアとそれに続くアルファベット \22 toto Unicode 文字とそれに続くアルファベット bili\.bob ピリオドは正しくエスケープされています
無効な識別子
34rem 数字で始まってはいけません -12rad ダッシュで始まって数字が続いてはいけません bili.bob アルファベットと数字以外でエスケープせずに使えるのは _ と - だけです --toto 2 つのダッシュで始まってはいけません 'bilibob' <string> です "bilibob" <string> です
仕様書
仕様書 | 状態 | 備考 |
---|---|---|
CSS Values and Units Module Level 4<custom-ident> の定義 |
編集者草案 | |
CSS Will Change Module Level 1<custom-ident> for will-change の定義 |
勧告候補 | will-change で除外する値を定義。 |
CSS Counter Styles Level 3<custom-ident> for list-style-type の定義 |
勧告候補 | キーワードの有限リストの代わりに <custom-ident> を使用。 list-style-type と @counter-style で除外する値を定義。 |
CSS Lists Module Level 3<custom-ident> for counter-* の定義 |
草案 | <identifier> から <custom-ident> へ改名。使い方を新しい counter-set プロパティへ追加。 |
CSS Animations Level 1<custom-ident> for animation-name の定義 |
草案 | animation-name で除外する値を定義。 |
CSS Values and Units Module Level 3<custom-ident> の定義 |
勧告候補 | <identifier> から <custom-ident> へ改名。擬似型とし、除外値の使用を禁止した。 |
CSS Level 2 (Revision 1)<identifier> の定義 |
勧告 | 初回定義 |
ブラウザーの互換性
このデータ型は実際の型ではありませんが、許可された値をシンプルに記述するのに役立つ便利な型です。ブラウザーの互換性についての情報はありません。