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>
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;
}