CSS画流程进度导航引导条

一、CSS部分

 /* 基本的样式 */
.progress li{
	font-size: 15px;
    padding: 0px 20px;   
    line-height: 40px;  
    background: #05a5fd;  
    display: inline-block;   
    color: #fff;  
    position: relative;  
}
/* 用 :after 伪类画出一个三角形,定位到右边 */
.progress li:after{  
    content: '';  
    display: block;  
    border-top: 20px solid transparent;  
    border-bottom: 20px solid transparent;  
    border-left: 20px solid #05a5fd;  
    position: absolute;   
	right: -20px;
    top: 0;  
    z-index: 10;  
}
/* 用 :before 伪类来画出左边的三角形 */
.progress li:before{  
    content: '';  
    display: block;  
    border-top: 20px solid transparent;  
    border-bottom: 20px solid transparent;  
    border-left: 20px solid white;  
    position: absolute;   
    left: 0px;   
    top: 0;  
}
/* 把开头和结尾的稍微修饰一下 */
.progress li:first-child{    
    border-radius: 4px 0 0 4px !important;    
    padding-left: 25px !important;  
}    
.progress li:last-child,.progressEnd{    
    border-radius: 0px 4px 4px 0px !important;    
    padding-right: 25px !important;  
}    
.progress li:first-child:before{    
    display: none !important;    
}    
.progress li:last-child:after,.progressEnd:after{    
    display: none !important;    
}
/* 加上选中状态 */
.progress li.active {  
    background-color: #5cb85c;  
}  
.progress li.active:after {  
    border-left-color: #5cb85c;  
}
/* 使文字右移居中 */
.progress li:not(:first-child) span {
	padding-left: 10px;
}
/* 使当前之后的li都变灰色 */
.progress li.active ~ li{
	background: #ccc;  
}
.progress li.active ~ li:after {
	content: '';  
    display: block;  
    border-top: 20px solid transparent;  
    border-bottom: 20px solid transparent;  
    border-left: 20px solid #ccc;  
    position: absolute;   
	right: -20px;
    top: 0;  
    z-index: 10;  
}

二、HTML部分

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>进度流程引导图-示例</title>
        <link type="text/css" rel="stylesheet" href="progress.css"></link>
    </head>
    <body>
        <div>
            <ul class="progress">
                <li id="first" title="第一种角色-第一个环节"><span>第一个环节</span></li>
                <li id="second" title="第一种角色-第二个环节"><span>第二个环节</span></li>
                <li id="third" title="第一种角色-第三个环节"><span>第三个环节</span></li>
                <li id="fourth" class="active" title="第二种角色-第四个环节"><span>第四个环节</span></li>
                <li id="fifth"title="第二种角色-第五个环节"><span>第五个环节</span></li>
                <li id="sixth" title="第二种角色-第六个环节"><span>第六个环节</span></li>
                <li id="seventh" title="第三种角色-第七个环节"><span>第七个环节</span></li>
                <li id="nighth" title="第三种角色-第八个环节"><span>第八个环节</span></li>
                <li id="ninth" title="第三种角色-第九个环节"><span>第九个环节</span></li>
            </ul>
        </div> 
    </body>
</html>

三、效果图

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值