iTakeo

手把手教你制作-带箭头的流程进度条。

纯CSS的带箭头流程进度条,兼容到IE8。

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

  • 首页
.cssNav li{  
    padding: 0px 20px;   
    line-height: 40px;  
    background: #50abe4;  
    display: inline-block;   
    color: #fff;  
    position: relative;  
}   
01.
02.
03.
04.
05.
06.
07.
08.

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

  • 首页
.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;  
}   
01.
02.
03.
04.
05.
06.
07.
08.
09.
10.

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

  • 首页
.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;  
}  
01.
02.
03.
04.
05.
06.
07.
08.
09.
10.
11.

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

  • 首页
.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;  
} 
01.
02.
03.
04.
05.
06.
07.
08.
09.
10.

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

  • 首页
  • 首页
  • 首页

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

  • 首页
  • 测试文字
  • 首页
  • 首页
.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;    
} 
01.
02.
03.
04.
05.
06.
07.
08.
09.
10.
11.
12.
13.
14.

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

  • 首页
  • 首页首页
  • 3
  • 4
  • 5
.cssNav li.active {  
    background-color: #ef72b6;  
}  
.cssNav li.active:after {  
    border-left-color: #ef72b6;  
} 
01.
02.
03.
04.
05.
06.
2015/12/24 0 / /
标签:  暂无标签

验证码: 8 + 8 =

回到顶部