是否可以访问由css:before规则生成的内容? [英] Is it possible to access the content generated by a css :before rule?
本文介绍了是否可以访问由css:before规则生成的内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用html5和 css计数器来计算文档中的数字。图编号css正在工作,但我需要能够生成包含图号的交叉引用。
有没有办法通过javascript访问这些值?我使用的计数器代码是:
body {counter-reset:section; }
section {counter-reset:figure;
counter-increment:section; }
section section {counter-reset:section; }
section> h1:before {content:counters(section,'。'); }
.figure> .caption:before {
counter-increment:figure;
content:'figure'counters(section,'。')' - 'counter(figure); }
section> h1:before,.figure> .caption:before {margin-right:.5em; }