Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reverse progressbar using CSS3

I have this EXAMPLE.

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

enter image description here

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;      
}
like image 212
Mils Avatar asked Feb 17 '23 19:02

Mils


2 Answers

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

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

DEMO

like image 177
Zoltan Toth Avatar answered Feb 19 '23 10:02

Zoltan Toth


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.net/fmaGZ/2/

like image 42
Prinzhorn Avatar answered Feb 19 '23 09:02

Prinzhorn