Is it possible to have a progress bar move from ri

2019-04-07 08:56发布

Before even embarking on this project, I'd like to know if it's at all possible to reverse the progress bar found in the bootstrap framework, so it can display a value going from right to left? The reason behind this question is that I have a range of numbers that can go from positive to negative. The idea is to place two progress bars next to each other and have the right one display the percentage range when the value is positive, and the left bar to display the percentage range when value is negative. For now, the values are static, but these will be 'live' in the future.

Any input on this, and if possible, a pointer to similar projects? I haven't really found anything relevant done with this framework.

I've looked at posts like this one: Reverse progressbar using CSS3, but I'm not sure if this is the way to go when using Bootstrap. Is there some sort of override available for this kind of functionality, in regards to css?

Right now, my progress bar is setup like so:

        <li>Speed<span class="pull-right"><em>@Math.Round(DepthValue, 2) m/min</em></span>
            <div class="progress progress-success">
                <div class="bar" style="width: @Model.SpeedRangePercentage%"></div>
            </div>
        </li>

8条回答
smile是对你的礼貌
2楼-- · 2019-04-07 09:19

Use transform: rotate(180deg); on the progress class.

查看更多
劫难
3楼-- · 2019-04-07 09:22

If I could propose a different option, it's even easier than this. Think about it this way:

<div class="progress">
  <div class="progress-bar progress-bar-info" role="progressbar" style="width:40%;"></div>
</div>

The .progress element is a block-level element, so just float or position the .progress-bar however you like inside it. Here is a quick fiddle of this idea for reference.

查看更多
登录 后发表回答