Css arrow Progress bar

后端 未结 2 1854
隐瞒了意图╮
隐瞒了意图╮ 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

    Although this may only be suitable for block color backgrounds, I thought I'd add it here (as I was learning I found that 'cutting the arrow out' was also an option). I started with a rectangle and 'cut the corners out' to create this:

    .arrow {
      height: 200px;
      width: 300px;
      background: rgb(169, 3, 41);
      background: -moz-linear-gradient(top, rgba(169, 3, 41, 1) 0%, rgba(143, 2, 34, 1) 44%, rgba(109, 0, 25, 1) 100%);
      background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, rgba(169, 3, 41, 1)), color-stop(44%, rgba(143, 2, 34, 1)), color-stop(100%, rgba(109, 0, 25, 1)));
      background: -webkit-linear-gradient(top, rgba(169, 3, 41, 1) 0%, rgba(143, 2, 34, 1) 44%, rgba(109, 0, 25, 1) 100%);
      background: -o-linear-gradient(top, rgba(169, 3, 41, 1) 0%, rgba(143, 2, 34, 1) 44%, rgba(109, 0, 25, 1) 100%);
      background: -ms-linear-gradient(top, rgba(169, 3, 41, 1) 0%, rgba(143, 2, 34, 1) 44%, rgba(109, 0, 25, 1) 100%);
      background: linear-gradient(to bottom, rgba(169, 3, 41, 1) 0%, rgba(143, 2, 34, 1) 44%, rgba(109, 0, 25, 1) 100%);
      filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#a90329', endColorstr='#6d0019', GradientType=0);
      position: relative;
      overflow: hidden;
      transition: all 0.8s;
    }
    .arrow:before {
      content: "";
      position: absolute;
      top: 0;
      width: 70%;
      height: calc(100% - 80px);
      border-top: 40px solid white;
      border-bottom: 40px solid white;
      z-index: 10;
    }
    .arrow:after {
      content: "";
      position: absolute;
      right: 0;
      border-top: 100px solid white;
      border-bottom: 100px solid white;
      border-left: 100px solid transparent;
      z-index: 10;
    }
    .perc {
      position: absolute;
      top: 0;
      width: 0%;
      height: 100%;
      background: rgb(30, 87, 153);
      background: -moz-linear-gradient(top, rgba(30, 87, 153, 1) 0%, rgba(41, 137, 216, 1) 50%, rgba(32, 124, 202, 1) 51%, rgba(125, 185, 232, 1) 100%);
      background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, rgba(30, 87, 153, 1)), color-stop(50%, rgba(41, 137, 216, 1)), color-stop(51%, rgba(32, 124, 202, 1)), color-stop(100%, rgba(125, 185, 232, 1)));
      background: -webkit-linear-gradient(top, rgba(30, 87, 153, 1) 0%, rgba(41, 137, 216, 1) 50%, rgba(32, 124, 202, 1) 51%, rgba(125, 185, 232, 1) 100%);
      background: -o-linear-gradient(top, rgba(30, 87, 153, 1) 0%, rgba(41, 137, 216, 1) 50%, rgba(32, 124, 202, 1) 51%, rgba(125, 185, 232, 1) 100%);
      background: -ms-linear-gradient(top, rgba(30, 87, 153, 1) 0%, rgba(41, 137, 216, 1) 50%, rgba(32, 124, 202, 1) 51%, rgba(125, 185, 232, 1) 100%);
      background: linear-gradient(to bottom, rgba(30, 87, 153, 1) 0%, rgba(41, 137, 216, 1) 50%, rgba(32, 124, 202, 1) 51%, rgba(125, 185, 232, 1) 100%);
      filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#1e5799', endColorstr='#7db9e8', GradientType=0);
      z-index: 5;
      transition: all 0.8s;
    }
    .arrow:hover .perc {
      width: 100%;
    }


    Let's not forget those who prefer Jsfiddle's instead


    It would also allow for a gradient colouring

提交回复
热议问题