本文介紹的是利用純CSS的帶箭頭流程進(jìn)度條,兼容到IE8,需要的朋友們下面來(lái)一起學(xué)習(xí)學(xué)習(xí)。
首先寫(xiě)出一個(gè)基本的樣式。
.cssNav li{ padding: 0px 20px; line-height: 40px; background: #50abe4; display: inline-block; color: #fff; position: relative; }
接下來(lái)使用 :after 偽類(lèi)畫(huà)出一個(gè)三角形,定位到右邊,如下:
.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; }
然后將after的顏色修改下,基本的雛形已經(jīng)看到了。
.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; }
繼續(xù)使用 :before 偽類(lèi)來(lái)畫(huà)出左邊的三角形。如下:
.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; }
然后修改下before的顏色,并復(fù)制多個(gè)模塊看看。
最后把開(kāi)頭和結(jié)尾的稍微修飾一下。
.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; }
加上選中狀態(tài),大功告成。
.cssNav li.active { background-color: #ef72b6; } .cssNav li.active:after { border-left-color: #ef72b6; }
總結(jié)
以上就是這篇文章的全部?jī)?nèi)容了,希望本文的內(nèi)容對(duì)大家的學(xué)習(xí)或者工作能帶來(lái)一定的幫助,如果有疑問(wèn)大家可以留言交流。
【網(wǎng)站聲明】本站除付費(fèi)源碼經(jīng)過(guò)測(cè)試外,其他素材未做測(cè)試,不保證完整性,網(wǎng)站上部分源碼僅限學(xué)習(xí)交流,請(qǐng)勿用于商業(yè)用途。如損害你的權(quán)益請(qǐng)聯(lián)系客服QQ:2655101040 給予處理,謝謝支持。