繁体   English   中英

有序列表上的特定样式

[英]Specific style on an ordered list

我需要一些帮助来整合2年前在草图上制作的设计! 我们的目标是制作漂亮的订购者清单,但我很难整合内容。

这是我到目前为止所做的:

HTML:

<div class="stepbar_block">
    <ol class="stepbar_list">
    <li class="stepbar_list_elem_active"> 50% </li>
    <li class="stepbar_list_item">60% </li>
    <li class="stepbar_list_item">70%</li>
    <li class="stepbar_list_elem_current">80%</li>
    <li class="stepbar_list_item">90%</li>
  </ol>
</div>

CSS:

.stepbar_block {
  margin: 0;
  padding: 0;
  counter-reset: step;
  position: relative;
  margin-top: 40px;
}

.stepbar_block:before {
  width: 1px;
  height :10px;
  background-color : rgba(87,87,86,0.3);
  content : '';
  position : absolute;
  left : 30px;
  top : -4px;
}

.stepbar_block:after {
  width: 1px;
  height :10px;
  background-color : rgba(87,87,86,0.3);
  content : '';
  position : absolute;
  right : 30px;
  top : -4px;
}

.stepbar_list li {
  list-style-type: none;
  float: left;
  width: 20%;
  height : 5px;
  position: relative;
  font-family: Roboto;  
  font-size: 10px;  
  line-height: 11px;    
  text-align: center;
  color: rgba(87,87,86,0.5);
}

.stepbar_list:after {
    content: '';
  position: absolute;
  height: 1px;
  background-color: rgba(87,87,86,0.3);
  left: 30px;
  right: 30px;
  z-index: 3;
}

.stepbar_list li:before {
  content : '';
  counter-increment: step;
  width: 5px;
  height: 5px;
  border: 1px solid black;
  display: block;
  background-color : black;
  border-radius: 40px;
  text-align: center;
  margin: -2px auto 10px auto;
}

.stepbar_list_item:after {
  content: counter(step);
  position: absolute;
  top: -25px;
  background-color: white;
  left: 0;
  right: 0;
  color: rgba(87,87,86,0.5);    
    font-size: 10px;    
  line-height: 11px;    text-align: center;
}

.stepbar_list_elem_active:after {
    content: counter(step);
  position: absolute;
  top: -25px;
  background-color: red;
  left: 0;
  right: 0;
}

.stepbar_list_elem_current:after {
    content: counter(step);
  position: absolute;
  top: -25px;
  background-color: blue;
  left: 0;
  right: 0;
}

https://jsfiddle.net/zawt9hL6/

但是我能够给项目着色而不是圆圈,所以我想知道缺少了什么,因为当我使用:before和:after时,似乎给整个列表项目而不是特定内容着色

那就是我想要的结果

在此处输入图片说明

可能有这样的渲染? 而且,这是圈子里的渐变背景。

谢谢您的建议

全部使用这样的东西。

.stepbar_list_elem_active:before {
   width: 10px;
   height: 10px;
   background-color: #fff;
   content: '';
   position: absolute;
   left: 0;
   top: -6px;
   border: 2px solid red;
   border-radius: 50%;
   right: 0;
   margin: 0 auto;
}

您可以使用:before:after伪元素来创建带有渐变的圆。 首先,您可以只创建带有渐变的规则圆,然后在第一个圆的顶部再添加一个带有其他伪元素的白色圆。

 10* { box-sizing: border-box; } ul { display: inline-flex; list-style: none; position: relative; padding: 0; margin: 0 50px; } ul:after { content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 2px; background: gray; } li { padding: 25px; position: relative; } li:after, li.color:before { position: absolute; content: ''; bottom: 0; left: 50%; height: 10px; width: 10px; background: gray; border-radius: 50%; transform: translate(-50%, 40%); z-index: 1; } li.color:after { width: 20px; height: 20px; transform: translate(-50%, 9px); } li.color:before { background: white; z-index: 2; width: 10px; height: 10px; } li.yellow:after { background: linear-gradient(to right, rgba(240,184,88,1) 0%, rgba(230,139,60,1) 38%, rgba(240,47,23,1) 71%, rgba(231,56,39,1) 100%); } li.blue:after { background: linear-gradient(to right, rgba(52,163,247,1) 0%, rgba(52,163,247,1) 32%, rgba(19,100,158,1) 71%, rgba(19,100,158,1) 100%); } .yellow { color: #ED4620; } .blue { color: #64A3D1; } 
 <ul> <li>1</li> <li class="color yellow">2</li> <li class="color blue">3</li> <li>4</li> </ul> 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM