【问题标题】:how to implement list bullets in CSS [closed]如何在 CSS 中实现列表项目符号 [关闭]
【发布时间】:2016-02-26 03:00:38
【问题描述】:

我有以下列表项的项目符号。如何在 CSS 中实现这些项目符号?

看图

【问题讨论】:

标签: css


【解决方案1】:

来自this 的回答,我编辑了它,所以这就是你想要的

CSS

body {
   counter-reset: item;
 }
 ol {
   list-style: none;
 }
 li {
   counter-increment: item;
   margin-bottom: 5px;
 }
 li:before {
   margin-right: 10px;
   content: counter(item);
   border-radius: 100%;
   border:2px solid #29465F;
   color:#29465F;
   font-weight:700;
   width: 1.2em;
   text-align: center;
   display: inline-block;
 }

HTML

<ol>
  <li>item</li>
  <li>item</li>
  <li>item</li>
  <li>item</li>
</ol>

Here's 小提琴

【讨论】:

    【解决方案2】:

    https://jsfiddle.net/RajReddy/k36qjnq4/ 这是一个有效的小提琴。

    css 样式是

     ol {
       list-style: none;
     }
     li {
        counter-increment: item;  
        margin-bottom: 5px;
     }
     li:before {
       margin-right: 5px;  
       content: counter(item);
       border-radius: 100%;
       border:1px solid; 
       width: 20px;
       text-align: center;
       display: inline-block;
     }
    

    【讨论】:

      【解决方案3】:

      假设您处于循环中并且可以访问数组的索引,您可以在其中创建一个带有数字的圆圈:

      <li>
          <span class="list-item-number">{{i+1}}</span>
          <span class="lite-item-value">{{item.name}}</li>
      </li>
      
      .list-item-number {
          border-radius: 100rem;
          width: 1rem;
          border: .2rem solid blue;
          background: white;
          text-align: center;
      }
      

      【讨论】:

      • 这是 angularJS 语法吗?
      • 是的,但是对于现在大多数客户端模板来说,角度语法非常普遍。你在用什么?
      • @chovy th OP 只有 CSS 标签。所以你不能确定他使用角度。我同意它现在很普遍,但仍然
      • 只是这个问题是关于 CSS 而不是 AngularJS
      猜你喜欢
      • 1970-01-01
      • 2018-09-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-11-21
      相关资源
      最近更新 更多