16

我正在使用twitter-bootstrap 的进度条控件

我想垂直对齐它,如下图所示:

引导程序

我找到了这个线程,但恐怕它现在不起作用。

所以我这样做:http ://tinker.io/e69ff/2

HTML

<br>
<div class="progress vertical">
  <div class="bar bar-success" style="width: 70%;"></div>
  <div class="bar bar-warning" style="width: 20%;"></div>
  <div class="bar bar-danger" style="width: 10%;"></div>
</div>

CSS

.progress.vertical {
    position: relative;
    width: 20px;
    min-height: 240px;
    float: left;
    margin-right: 20px;
    background: none;
    -webkit-box-shadow: none;
    -moz-box-shadow: none;
    box-shadow: none;
    border: none;
}

你有任何提示或建议来获得它吗?如果您需要更多信息,请告诉我,我将编辑帖子。

4

6 回答 6

20

Bootstrap 3 和 Bootstrap 4 解决方案。

演示:https ://jsfiddle.net/elijahmurray/7tgh988z/

在此处输入图像描述

一段时间以来,我一直在努力寻找解决这个问题的好方法。最终,我最终编写了自己的代码,它在语义上类似于 Bootstrap 构建进度条的方式。

这个解决方案也没有使用transform,我发现在使用它时确实搞砸了很多关于定位的事情。更不用说,它只是对此感到困惑。

HTML

<div class="progress progress-bar-vertical">
  <div class="progress-bar" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="height: 60%;">
    <span class="sr-only">60% Complete</span>
  </div>
</div>

CSS

.progress-bar-vertical {
  width: 20px;
  min-height: 100px;
  margin-right: 20px;
  float: left;
  display: -webkit-box;  /* OLD - iOS 6-, Safari 3.1-6, BB7 */
  display: -ms-flexbox;  /* TWEENER - IE 10 */
  display: -webkit-flex; /* NEW - Safari 6.1+. iOS 7.1+, BB10 */
  display: flex;         /* NEW, Spec - Firefox, Chrome, Opera */
  align-items: flex-end;
  -webkit-align-items: flex-end; /* Safari 7.0+ */
}

.progress-bar-vertical .progress-bar {
  width: 100%;
  height: 0;
  -webkit-transition: height 0.6s ease;
  -o-transition: height 0.6s ease;
  transition: height 0.6s ease;
}

如果这有帮助,请投票!

于 2016-01-15T03:11:11.427 回答
10

引导程序 2

请注意,这是引导程序 2 的解决方案:

宽度 100%,高度可变:

<br>
<div class="progress vertical">
  <div class="bar bar-success" style="height: 70%;width:100%"></div>
  <div class="bar bar-warning" style="height: 20%;width:100%"></div>
  <div class="bar bar-danger" style="height: 10%;width:100%"></div>
</div>

引导程序 3+

我希望您参考此页面上的其他评论

于 2013-05-01T12:52:22.137 回答
6

这将起作用:

.progress{
  transform: rotate(-90deg);
} 

http://codepen.io/mcgraw/pen/eCwvu

于 2015-05-04T18:32:05.540 回答
2

将 twitter 引导进度条和动画从水平位置更改为垂直位置

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



HTML


<div class="progress progress-vertical progress-striped active progress-success">
    <div class="bar" style="width: 40px;"></div>
</div>
<div class="progress progress-vertical progress-striped active progress-danger">
    <div class="bar" style="width: 40px;"></div>
</div>

CSS


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

修改 Twitter bootstrap.css 文件,如下所示:

        @-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;
  }
}

将 background-repeat 更改为repeat-y并将度数更改为0deg。所以,动画垂直渲染

    .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);
}

与其他进度类型(如成功、警告等)相同,并实现垂直 twitter 引导进度条和动画......!

对于您有任何疑问,让我知道我可以帮助您..!

如果有人有比这更优化的解决方案,请告诉我..!

不要忘记支持这个解决方案..!

享受!

于 2013-07-23T04:40:19.143 回答
0

对于主要进度类,添加以下内容

.progress{
     display: flex;
     flex-direction: column-reverse;
}
于 2021-11-19T14:09:09.413 回答
-1

CSS

.progress{
position: absolute;left:50.5%;top:40%;width: 2.5%;height:50%;opacity: 0.8; filter: alpha(opacity=80);
}
.progress-bar{
  position:absolute;top:20%; width: 100%;height: 80%;
}

在此处查看完整的代码和实现

于 2018-09-08T14:16:47.853 回答