Skip to main content

string-no-newline

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

¥Disallow invalid newlines within strings.

a {
content: "foo
bar"; }/* ↑

* ↑

* 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 ()."

此规则与以下内容重叠:

¥This rule overlaps with:

我们建议配置此规则以使其不重叠。

¥We recommend configuring this rule so that it doesn't overlap.

选项

¥Options

true

以下模式被视为问题:

¥The following patterns are considered problems:

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

以下模式不被视为问题:

¥The following patterns are not considered problems:

a {
content: "foo\Abar";
}
a {
content: "foo\\nbar";
}
[title="nothing\
is wrong"] {}
a {
font-family: "Times New Roman";
}

可选的辅助选项

¥Optional secondary options

ignore: ["at-rule-preludes", "declaration-values"]

"at-rule-preludes"

忽略规则前奏中的字符串。

¥Ignore strings in at-rule preludes.

以下模式不被视为问题:

¥The following patterns are not considered problems:

@import url('foo
.css');

"declaration-values"

忽略声明值中的字符串。

¥Ignore strings in declaration values.

以下模式不被视为问题:

¥The following patterns are not considered problems:

a {
content: "foo
bar";
}