css实现箭头流程,CSS实现带箭头的流程进度条

本文介绍的是利用纯CSS的带箭头流程进度条,兼容到IE8,需要的朋友们下面来一起学习学习。

首先写出一个基本的样式。

6cb5361e26fc01949ced305a66199341.png

.cssNav li{

padding: 0px 20px;

line-height: 40px;

background: #50abe4;

display: inline-block;

color: #fff;

position: relative;

}

接下来使用 :after 伪类画出一个三角形,定位到右边,如下:

a24818d2b772086712ff3b575f86f957.png

.cssNav li:after{

content: '';

display: block;

border-top: 20px solid red;

border-bottom: 20px solid red;

border-left: 20px solid blue;

position: absolute;

rightright: -20px;

top: 0;

}

然后将after的颜色修改下,基本的雏形已经看到了。

aa6cb5f863cb8e09084316f46543b99a.png

.cssNav li:after{

content: '';

display: block;

border-top: 20px solid transparent;

border-bottom: 20px solid transparent;

border-left: 20px solid #50abe4;

position: absolute;

rightright: -20px;

top: 0;

z-index: 10;

}

继续使用 :before 伪类来画出左边的三角形。如下:

e42d6f859e3ea4fe12f14611e5d8bedc.png

.cssNav li:before{

content: '';

display: block;

border-top: 20px solid red;

border-bottom: 20px solid red;

border-left: 20px solid blue;

position: absolute;

left: 0px;

top: 0;

}

然后修改下before的颜色,并复制多个模块看看。

00f6ea30378648214255abc0db641bb2.png

最后把开头和结尾的稍微修饰一下。

963387e7f084a51dea4e278fd7dd7baf.png

.cssNav li:first-child{

border-radius: 4px 0 0 4px;

padding-left: 25px;

}

.cssNav li:last-child,.cssNavEnd{

border-radius: 0px 4px 4px 0px;

padding-right: 25px;

}

.cssNav li:first-child:before{

display: none;

}

.cssNav li:last-child:after,.cssNavEnd:after{

display: none;

}

加上选中状态,大功告成。

968020761a58fe044afcca2a970ca385.png

.cssNav li.active {

background-color: #ef72b6;

}

.cssNav li.active:after {

border-left-color: #ef72b6;

}

(资源库 www.zyku.net)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值