ident - CSS: Cascading Style Sheets 编辑

Draft

This page is not complete.

The <ident> CSS data type denotes an arbitrary string used as an identifier.

Syntax

The syntax of <custom-ident> is similar to CSS identifiers (such as property names), except that it is case-sensitive. It consists of one or more characters, where characters can be any of the following:

  • any alphabetical character (A to Z, or a to z),
  • any decimal digit (0 to 9),
  • a hyphen (-),
  • an underscore (_),
  • an escaped character (preceded by a backslash, \),
  • a Unicode character (in the format of a backslash, \, followed by one to six hexadecimal digits, representing its Unicode code point)

Note that id1, Id1, iD1 and ID1 are all different identifiers as they are case-sensitive. On the other hand, as there are several ways to escape a character, toto\? and toto\3F are the same identifiers.

Examples

Valid identifiers

nono79      	A mix of alphanumeric characters and numbers
ground-level	A mix of alphanumeric characters and a dash
-test       	A dash followed by alphanumeric characters
--toto      	A custom-property like identifier
_internal   	An underscore followed by alphanumeric characters
\22 toto    	A Unicode character followed by a sequence of alphanumeric characters
bili\.bob   	A correctly escaped period

Invalid identifiers

34rem   	It must not start with a decimal digit.
-12rad  	It must not start with a dash followed by a decimal digit.
bili.bob	Only alphanumeric characters, _, and - needn't be escaped.
'bilibob'	This would be a <string>.
"bilibob"	This would be a <string>.

Specifications

SpecificationStatusComment
CSS Values and Units Module Level 4
The definition of '<ident>' in that specification.
Editor's Draft
CSS Values and Units Module Level 3
The definition of '<ident>' in that specification.
Candidate Recommendation

Browser compatibility

As this type is not a real type but a convenience type used to simplify the definition of other CSS syntax.

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:119 次

字数:4519

最后编辑:6 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文