h1{ counter-increment:mycounter; //若不加此段,则编号都是0 } h1:before{ content:counter(mycounter); content:"第" counter(mycounter) "章"; //也可以加入中文,用双引号引起来即可 content:"第"counter(mycounter,upper-roman)"章 "; //这里会显示成:第I章 第II章 第III章 }
h1{ counter-increment:mycounter; //若不加此段,则编号都是0 } h1:before{ content:counter(mycounter); content:"第" counter(mycounter) "章"; //也可以加入中文,用双引号引起来即可 content:"第"counter(mycounter,upper-roman)"章 "; //这里会显示成:第I章 第II章 第III章 }
转载于:https://www.cnblogs.com/dengxiaoqing/p/5139124.html