Css arrow Progress bar

后端 未结 2 1848
隐瞒了意图╮
隐瞒了意图╮ 2020-12-31 14:46

I\'m currently in the process of learning all about css, so I\'m trying to generate different shapes with different functionalities.


I am currently working on

2条回答
  •  旧巷少年郎
    2020-12-31 15:30

    You can animate just the width of the .prog element and set it to overlfow: hidden

    .prog{
        width: 0%;
        height:100%;
        position: relative;
        overflow: hidden;
        transition: width 0.8s 
    }
    .arrow:hover .prog{
        width: 300px;
    }
    .arrow{  
        height:200px;
        margin:0 auto;
        width:300px;
        position:relative;
        margin-top:60px;
    }
    .arrow,.arrow:before,.arrow:after{
        z-index:1
    }
    .prog,.prog:before,.prog:after{
        z-index:2
    }
    .arrow:before, .prog:before,
    .arrow:after, .prog:after{
        content:"";
        position:absolute;
    }
    .arrow:before, .prog:before{
        left: 200px;
        top: 0px;
        border-top: 100px solid transparent;
        border-bottom: 100px solid transparent;
    }
    .arrow:after, .prog:after{
        margin: 0 auto;
        height: 100px;
        width: 200px;
        top: 50px;
        left: 0
    }
    .arrow:before{
        border-left: 100px solid red
    }
    .arrow:after{
        background: red
    }
    .prog:before{
        border-left: 100px solid blue
    }
    .prog:after{
        background: blue
    }

提交回复
热议问题