A, CSS section
/* 基本的样式 */
.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;
}
Two, HTML part
<!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>
Third, renderings