admin管理员组

文章数量:1289381

I have this EXAMPLE.

I want to reverse the progress bar 180 degree to progress from right to left. To obtain something like this :

I tried to change the transition attribute but no result.

Code :

.progress-bar span {
        display: inline-block;
        height: 100%;
        background-color: #777;
        -moz-border-radius: 3px;
        -webkit-border-radius: 3px;
        border-radius: 3px;
        -moz-box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset;
        -webkit-box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset;
        box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset;
        transition: width .4s ease-in-out;      
}

I have this EXAMPLE.

I want to reverse the progress bar 180 degree to progress from right to left. To obtain something like this :

I tried to change the transition attribute but no result.

Code :

.progress-bar span {
        display: inline-block;
        height: 100%;
        background-color: #777;
        -moz-border-radius: 3px;
        -webkit-border-radius: 3px;
        border-radius: 3px;
        -moz-box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset;
        -webkit-box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset;
        box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset;
        transition: width .4s ease-in-out;      
}
Share Improve this question edited Apr 15, 2013 at 14:49 Mils asked Apr 15, 2013 at 14:16 MilsMils 4883 silver badges15 bronze badges 1
  • 4 transform: rotate(180deg); did the trick for me – Stefan Candan Commented Apr 15, 2013 at 14:20
Add a ment  | 

3 Answers 3

Reset to default 7

Make the progress bar block and just float it to the right:

.progress-bar span {
    display: block;
    float: right;
    ...
}

DEMO

Make the span a block element and use margin-left. But you need to inverse the progress as well. E.g. 30% needs margin-left:70%;

http://jsfiddle/fmaGZ/2/

Having a <progress class="progress" /> html tag you could use:

.progress {
  direction: rtl;
}

本文标签: javascriptReverse progressbar using CSS3Stack Overflow