伪元素做进度条

伪元素
1、作用:CSS伪元素是用来添加一些选择器的特殊效果。
2、语法:

伪元素的语法:
selector:pseudo-element {property:value;}
CSS类也可以使用伪元素:
selector.class:pseudo-element {property:value;}

3、常用伪元素:
在这里插入图片描述

做进度条的样式主要就是用到after在元素后面插入内容、
结合定位的z-index实现遮盖、分离的进度条的效果,如图:

代码实现:

主要html:
<ul class="psur_plan_step">
	<li class="stepOver active" style="z-index: 3;">等待期</li>
	<li class="stepOver active_af" style="z-index: 2;">编写期</li>
	<li class="stepOver active_af_af" style="z-index: 1;">提交期</li>
</ul>
主要style:
.psur_plan_step .stepOver{font-size: 10px;  display:inline-block;  position:relative; line-height:18px;height:18px;  width:46px;background:#EBEBEB;text-align:center;margin-right:2px; padding-left:3px;}
.psur_plan_step .stepOver:before {position:absolute;left:0;  top:0;  height:0;width:0;  border-bottom:9px inset transparent;border-left:9px solid #fff;  border-top:9px inset transparent;  content:""}
.psur_plan_step .stepOver:after {position:absolute;right:-9px;top:0;height:0;width:0;border-bottom:9px inset transparent;border-left:9px solid #EBEBEB;border-top:9px inset transparent;content:"";z-index:2}
.psur_plan_step .stepOver.active{color:#fff;background:#ccc;}
.psur_plan_step .stepOver.active:after {  border-left-color:#ccc;}
.psur_plan_step .stepOver.active_af{color:#fff;background:#70E09C;}
.psur_plan_step .stepOver.active_af:after {  border-left-color:#70E09C;}
.psur_plan_step .stepOver.active_af_af{color:#fff;background:red;}
.psur_plan_step .stepOver.active_af_af:after {  border-left-color:red;}
.psur_plan_step .stepOver:first-child:before{  border: 0}
.psur_plan_step .stepOver:last-child:after{border: 0}
.psur_plan_step .stepOver:nth-child(1){width:40px;}
.psur_plan_step .stepOver:nth-child(2){text-align:right;}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值