We're looking for a person or people to help audit MDN to find places we could speed up. Is this you or someone you know? Check out the RFP: https://mzl.la/2IHcMiE


在CSS中,<string> 是用来表示一串字符的数据类型,它被用在众多CSS属性中,例如contentfont-family、和quotes


<string> 数据类型是由包含在英文双引号(")或英文单引号(')中的任意数量的Unicode字符组成。




注意: CSS<string>中不能使用像&nbsp;或者&#8212;这样的实体。


/* Simple strings */
"This string is demarkated by double quotes."
'This string is demarkated by single quotes.'

/* Character escaping */
"This is a string with \" an escaped double quote."
"This string also has \22 an escaped double quote."
'This is a string with \' an escaped single quote.'
'This string also has \27 an escaped single quote.'
"This is a string with \\ an escaped backslash."

/* New line in a string */
"This string has a \Aline break in it."

/* String spanning two lines of code (these two strings will have identical output) */
"A really long \
awesome string"
"A really long awesome string"


Specification Status Comment
CSS Values and Units Module Level 3
Candidate Recommendation No significant change from CSS Level 2 (Revision 1).
CSS Level 2 (Revision 1)
Recommendation Explicit definition; allows 6-digit Unicode escaped characters.
CSS Level 1
Recommendation Implicit definition; allows 4-digit Unicode escaped characters.


We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 1.0 1.0 (1.0) (Yes) (Yes) 1.0 (85)
\xx 1.0 1.0 (1.0) 6.0 (Yes) 1.0 (85)
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support (Yes) (Yes) (Yes) (Yes) (Yes) (Yes)
\xx (Yes) (Yes) (Yes) (Yes) (Yes) (Yes)


 此页面的贡献者: LiuYuan
 最后编辑者: LiuYuan,