纯css步骤条编写

css文件

.steps {
		position: relative;
		margin-bottom: 30px;
		counter-reset: step;
		/*创建步骤数字计数器*/
}
/*步骤描述*/
.steps li {
		list-style-type: none;
		font-size: 12px;
		text-align: center;
		width: 10%;      //如果一行想显示多个节点,修改这里的大小
		position: relative;
		float: left;
}

/* 步骤数字 */
.steps li:before {
		display: block;
		content: counter(step);
		/*设定计数器内容*/
		counter-increment: step;
		/*计数器值递增*/
		width: 32px;
		height: 32px;
		background-color: #019875;
		line-height: 32px;
		border-radius: 32px;
		font-size: 16px;
		color: #fff;
		text-align: center;
		font-weight: 700;
		margin: 0 auto 8px auto;
}

/*步骤数字*/
.steps li~li:after {
		content: '';
		width: 75%;
		height: 3px;
		background-color: #019875;
		position: absolute;
		left: -33%;
		top: 13px;
		z-index: 0; 
		/*放置在数字后面*/
}
/*将当前/完成步骤之前的数字及连接线变绿*/
.steps li.active:before,
.steps li.active:after {
		background-color: #019875;
}

/*如果出现错误 那么成红色*/
.steps li.error:before,
.steps li.error:after {
		background-color: indianred;
}
/*将当前/完成步骤之后的数字及连接线变灰*/
.steps li.wait:before,
.steps li.wait:after{
		background-color: #777;
}

使用

<ul class="steps">
			<li>1</li>
			<li>2</li>
			<li>3</li>
			<li class="active">4</li>
			<li class="error">5</li>
			<li class="error">6</li>
			<li class="wait">7</li>
			<li class="wait">8</li>
			<li class="wait">9</li>
			<li class="wait">10</li>
		</ul>

其中,1、2、3、4成为绿色;5、6为红色;7、8、9、10为灰色

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值