zoukankan      html  css  js  c++  java
  • 带箭头的进度条

    本文介绍的是利用纯CSS的带箭头流程进度条,兼容到IE8,需要的朋友们下面来一起学习学习。

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

    1
    2
    3
    4
    5
    6
    7
    8
    .cssNav li{ 
        padding: 0px 20px;  
        line-height: 40px
        background: #50abe4
        display: inline-block;  
        color: #fff
        position: relative
    }

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

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    .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的颜色修改下,基本的雏形已经看到了。

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    .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 伪类来画出左边的三角形。如下:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    .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的颜色,并复制多个模块看看。

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

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    .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;   
    }

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

    1
    2
    3
    4
    5
    6
    .cssNav li.active { 
        background-color: #ef72b6
    .cssNav li.active:after { 
        border-left-color: #ef72b6
    }

    总结

    以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作能带来一定的帮助,如果有疑问大家可以留言交流。

  • 相关阅读:
    【历史时刻】从学生到社会独立人——硕士毕业
    Linux 常用命令
    LInux系统下搭建redis集群
    docker 下创建自定义网络,并在运行容器时绑定网络和ip
    docker下安装mysql镜像
    windows下将consul注册为系统服务
    Sql批量替换字段字符,Sql批量替换多字段字符,Sql替换字符
    gerrit安装配置
    Linux安装jdk8及环境变量配置
    iTerm2配置优化
  • 原文地址:https://www.cnblogs.com/qinyan20/p/6840193.html
Copyright © 2011-2022 走看看