源代码:<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>插入编号</title> <style> h1:before{ content: counter(jshuqi);/*计数器*/ } h1{ counter-increment:jshuqi ;/*元素追加到h1*/ } </style> </head> <body> <h1>插入编号</h1> <p>昨日,记者在“趣住”上随机与一位房客私聊,对方开门见山邀请</p> <h1>插入编号</h1> <p>昨日,记者在“趣住”上随机与一位房客私聊,对方开门见山邀请</p> <h1>插入编号</h1> <p>昨日,记者在“趣住”上随机与一位房客私聊,对方开门见山邀请</p> <h1>插入编号</h1> <p>昨日,记者在“趣住”上随机与一位房客私聊,对方开门见山邀请</p> <h1>插入编号</h1> <p>昨日,记者在“趣住”上随机与一位房客私聊,对方开门见山邀请</p> <h1>插入编号</h1> <p>昨日,记者在“趣住”上随机与一位房客私聊,对方开门见山邀请</p> </body> </html>
这是实现的效果:
2引入文字 更改: h1:before{ content:'第' counter(jshuqi)'讲';/*计数器*/ } h1{ counter-increment:jshuqi ;/*元素追加到h1*/ } 3指定编号的样式 h1:before{ content: counter(jshuqi)'.';/*计数器*/ color: #06ff29; font-size: 48px; } h1{ counter-increment:jshuqi ;/*元素追加到h1*/
} 4 编号种类 upper-alpha大写字母 h1:before{ content: counter(jshuqi,upper-alpha)'.';/*计数器*/ color: #06ff29; font-size: 48px; } h1{ counter-increment:jshuqi ;/*元素追加到h1*/ } 换成阿拉伯数字:content: counter(jshuqi,upper-roman)'.';/*计数器*/
分享知识,分享快乐!希望中国站在编程之巅! ----融水公子 公众微信号:rsgz520
360图书馆馆号:rsgz002.360doc.com
|