Home > Article > Web Front-end > Use CSS to implement a process progress bar with arrows
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.
.cssNav li{ padding: 0px 20px; line-height: 40px; background: #50abe4; display: inline-block; color: #fff; position: relative; }
Next use the :after pseudo-class to draw a triangle and position it to the right, as follows:
.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; }
Then modify the color of after, and the basic prototype has been seen.
.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; }
Continue to use the :before pseudo-class to draw the left triangle. As follows:
.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; }
Then modify the color of before and copy multiple modules to take a look.
Finally, slightly modify the beginning and end.
.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; }
Add the selected status and you're done.
.cssNav li.active { background-color: #ef72b6; } .cssNav li.active:after { border-left-color: #ef72b6; }