7
CSS的,我有以下CSS之前把內容用jQuery
h1:before {
content: "Chapter " counter(lvl1) "\000d\000a";
counter-increment: lvl1;
white-space: pre-wrap;
}
h1 {
page-break-before: right;
}
這個HTML
<p>...</p>
<h1>A Title</h1>
<p>...</p>
在給定的CSS我得到類似
Chapter 1
A Title
當我嘗試使用jQuery獲取文本我得到「標題」。是否有可能獲得「第1章\ nA標題」?
由於
工作小提琴,對於任何感興趣的人:http://jsfiddle.net/YdMcv/2/ – Eric 2013-02-16 17:56:23
其實,這不是很正確,因爲它從CSS文件中獲得文字「:before」的內容,而不是實際生成的內容。 OP希望'Chapter 1',而不是'Chapter' counter(lvl1)'......很酷的答案,但我認爲它不會有用。 – 2013-02-16 17:57:42
@Eric:謝謝你,編輯。 – 2013-02-16 17:57:48