`
lihong11
  • 浏览: 450641 次
  • 性别: Icon_minigender_2
  • 来自: 湖南
社区版块
存档分类
最新评论

css :before的用法

阅读更多

<style>

ol>li {

  list-style-type:none;

  counter-increment:item;

}

ol>li:before {

  width:1.5em;

  font-weight:bold;

  content:counter(item) ".";

}

</style>

<html>

   <ol>

     <li>a</li>

     <li>b</li>

     <li>c</li>

   </ol>

</html>

run result:

1.a

2.b

3.c

note:  :before 是指设置 'content'的内容样式。 

counter 是动态设置li的序列样式,item-->:before item.

0
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics