encoded "content:" character in CSS?

Possible Duplicate:
Adding HTML entities using CSS content

I have the following setup

CSS:

.header:before {
    content: "«";
}

.header:after {
    content: "»";
}

HTML:

<h3 class="header">Hello, this is some text which should be wrapped.</h3>

I'd simply like whatever is written in header to be wrapped in « ( &laquo; ) and » ( &raquo; ). How can I make this work in the CSS? It's currently appearing as:

&laquo; Hello, this is some text which should be wrapped. &raquo;

rather than:

« Hello, this is some text which should be wrapped. »


You can't use HTML entities in CSS, but you can use Unicode hex escapes, such as

span.url:before { content: "27e8" }
span.url:after { content: "27e9" }

(from one of my own stylesheets -- look up the hex codepoints for the exact characters you want yourself). Notice that unlike in some other notations, hex digits follow the backslash directly, with no intervening u .

链接地址: http://www.djcxy.com/p/88346.html

上一篇: 在Pwm中以列表形式输出字符串

下一篇: 在CSS中编码“content:”字符?