How to vertically align a progress bar in Twitter Bootstrap?

后端 未结 5 614
天命终不由人
天命终不由人 2020-12-13 07:30

I\'m using the progressbar control of twitter-bootstrap.

I want to align it vertically to look like in the following image:

5条回答
  •  南笙
    南笙 (楼主)
    2020-12-13 08:16

    Changing the twitter bootstrap progress bar and animation from horizontal position to vertical position

    ========================================================================



    HTML



    CSS


    .progress-vertical {
    position: relative;
    width: 40px;
    min-height: 240px;
    float: left;
    margin-right: 20px; }
    

    Modify The Twitter bootstrap.css file as specified below:

            @-webkit-keyframes progress-bar-stripes {
      from {
        background-position: 0 40px;
      }
      to {
        background-position: 0 0;
      }
    }
    @-moz-keyframes progress-bar-stripes {
      from {
        background-position: 0 40px;
      }
      to {
        background-position: 0 0;
      }
    }
    @-ms-keyframes progress-bar-stripes {
      from {
        background-position: 0 40px;
      }
      to {
        background-position: 0 0;
      }
    }
    @-o-keyframes progress-bar-stripes {
      from {
        background-position: 0 0;
      }
      to {
        background-position: 0 40px;
      }
    }
    @keyframes progress-bar-stripes {
      from {
        background-position: 0 40px;
      }
      to {
        background-position: 0 0;
      }
    }
    

    Change background-repeat to repeat-y and the degrees to 0deg. so, that the animation renders vertically

        .progress-danger .bar,
        .progress .bar-danger {
          background-repeat: repeat-y;
          }
    
    .progress-danger.progress-striped .bar,
    .progress-striped .bar-danger {
      background-color: #ee5f5b;
      background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));
      background-image: -webkit-linear-gradient(0deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
      background-image: -moz-linear-gradient(0deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
      background-image: -o-linear-gradient(0deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
      background-image: linear-gradient(0deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
    }
    

    Follow the same with the other progress types like success,warning etc and achieve vertical twitter bootstrap progress bars and animations...!

    For you have any queries let me know I may help you..!

    If any one out there have any optimized solution than this then please let me know..!

    Don't forget to support this solution..!

    Enjoy!

提交回复
热议问题