Home > Web Front-end > CSS Tutorial > Use CSS to implement a process progress bar with arrows

Use CSS to implement a process progress bar with arrows

高洛峰
Release: 2017-02-28 13:43:34
Original
2249 people have browsed it

This article introduces the process progress bar with arrows using pure CSS, which is compatible with IE8. Friends who need it can learn it together.

First write a basic style.

Use CSS to implement a process progress bar with arrows

.cssNav li{  
    padding: 0px 20px;   
    line-height: 40px;  
    background: #50abe4;  
    display: inline-block;   
    color: #fff;  
    position: relative;  
}
Copy after login

Next use the :after pseudo-class to draw a triangle and position it to the right, as follows:

Use CSS to implement a process progress bar with arrows

.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;  
}
Copy after login

Then modify the color of after, and the basic prototype has been seen.

Use CSS to implement a process progress bar with arrows

.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;  
}
Copy after login

Continue to use the :before pseudo-class to draw the left triangle. As follows:

Use CSS to implement a process progress bar with arrows

.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;  
}
Copy after login

Then modify the color of before and copy multiple modules to take a look.

Use CSS to implement a process progress bar with arrows

Finally, slightly modify the beginning and end.

Use CSS to implement a process progress bar with arrows

.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;    
}
Copy after login

Add the selected status and you're done.

Use CSS to implement a process progress bar with arrows

.cssNav li.active {  
    background-color: #ef72b6;  
}  
.cssNav li.active:after {  
    border-left-color: #ef72b6;  
}
Copy after login


##More related articles using CSS to implement process progress bars with arrows Please pay attention to PHP Chinese website!


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template