Skip to main content

string-no-newline

禁止字符串中无效的换行符。

¥Disallow invalid newlines within strings.

a {
content: "first
second"; }/* ↑

* ↑

* The newline here */

规范 是这样说的:“字符串不能直接包含换行符。要在字符串中包含换行符,请使用表示 ISO-10646 (U+000A) 中换行符的转义符,例如 '\A' 或 '\00000a'。” 并且:"出于美观或其他原因,可以将字符串分成几行,但在这种情况下,必须使用反斜杠 () 转义换行符本身。"

¥The spec says this: "A string cannot directly contain a newline. To include a newline in a string, use an escape representing the line feed character in ISO-10646 (U+000A), such as '\A' or '\00000a'." And also: "It is possible to break strings over several lines, for aesthetic or other reasons, but in such a case the newline itself has to be escaped with a backslash ()."

选项

¥Options

true

以下模式被视为问题:

¥The following patterns are considered problems:

a {
content: "first
second";
}
[title="something
is probably wrong"] {}
a {
font-family: "Times
New
Roman";
}

以下模式不被视为问题:

¥The following patterns are not considered problems:

a {
content: "first\Asecond";
}
a {
content: "first\\nsecond";
}
[title="nothing\
is wrong"] {}
a {
font-family: "Times New Roman";
}