用CSS實現帶箭頭的流程進度條

來源:互聯網
上載者:User
本文介紹的是利用純CSS的帶箭頭流程進度條,相容到IE8,需要的朋友們下面來一起學習學習。

首先寫出一個基本的樣式。

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

接下來使用 :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;  }

然後將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;  }

繼續使用 :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;  }

然後修改下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;    }

加上選中狀態,大功告成。

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


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.