Here is a more complex example. The first two pairs of curly braces are inside a string, and do not mark the end of the selector. This is a valid CSS 2.1 rule.
p[example="public class foo\
{\
private int x;\
\
foo(int x) {\
this.x = x;\
}\
\
}"]{color:red}
いかにも以下のような要素が赤色で表示されそうに期待するところだが、
実際はそうならない。
<pexample="public class foo
{
private int x;
foo(int x) {
this.x = x;
}
}">test</p>
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". (参考訳:文字列は直接改行を含むことはできない。文字列に改行を含むには、ISO 10646で(U+000A)をエスケープ表現した改行文字"\A"または"\00000a"を用いる。この文字は、CSSで"改行"の一般概念を表現する。)
というわけで、以下(再掲)の要素をスタイリングするには、
<pexample="public class foo
{
private int x;
foo(int x) {
this.x = x;
}
}">test</p>