Tutto quello che serve sono due div, il primo div rappresenterà il contenitore principale che avrà angoli arrotondati e un effetto ombra, il secondo div sarà la barra di avanzamento effettiva.
Se volete potete aggiungere una casella di input ed un pulsante per il controllo della barra di avanzamento.
Il codice HTML
1 2 3 4 5 6 7 |
<div id="prbar"> <div id="prpos"> </div> </div> <input id="moveTo" value="57" style="width:30px;" />% <button onclick="MoveTo();return false;">Move</button> |
Ed ora il codice CSS
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
#prbar { margin:5px; width:500px; background-color:#dddddd; overflow:hidden; /* Rounded Border */ border: 1px solid #bbbbbb; -moz-border-radius: 15px; border-radius: 15px; /* Adding some shadow to the progress bar */ -webkit-box-shadow: 0px 2px 4px #555555; -moz-box-shadow: 0px 2px 4px #555555; box-shadow: 0px 2px 4px #555555; } /* No rounded corners for Opera, because the overflow:hidden dont work with rounded corners */ doesnotexist:-o-prefocus, #prbar { border-radius:0px; } #prpos { width:0%; height:30px; background-color:#3399ff; border-right:1px solid #bbbbbb; /* CSS3 Progress Bar Transitions */ transition: width 2s ease; -webkit-transition: width 0s ease; -o-transition: width 0s ease; -moz-transition: width 0s ease; -ms-transition: width 0s ease; /* CSS3 Stripes */ background-image: linear-gradient(135deg,#3399ff 25%,#99ccff 25%,#99ccff 50%, #3399ff 50%, #3399ff 75%,#99ccff 75%,#99ccff 100%); background-image: -moz-linear-gradient(135deg,#3399ff 25%,#99ccff 25%,#99ccff 50%, #3399ff 50%, #3399ff 75%,#99ccff 75%,#99ccff 100%); background-image: -ms-linear-gradient(135deg,#3399ff 25%,#99ccff 25%,#99ccff 50%, #3399ff 50%, #3399ff 75%,#99ccff 75%,#99ccff 100%); background-image: -o-linear-gradient(135deg,#3399ff 25%,#99ccff 25%,#99ccff 50%, #3399ff 50%, #3399ff 75%,#99ccff 75%,#99ccff 100%); background-image: -webkit-gradient(linear, 100% 100%, 0 0,color-stop(.25, #99ccff), color-stop(.25, #3399ff),color-stop(.5, #3399ff),color-stop(.5, #99ccff),color-stop(.75, #99ccff),color-stop(.75, #3399ff),color-stop(1, #3399ff)); background-image: -webkit-linear-gradient(135deg,#3399ff 25%,#99ccff 25%,#99ccff 50%, #3399ff 50%, #3399ff 75%,#99ccff 75%,#99ccff 100%); background-size: 40px 40px; /* Background stripes animation */ animation: bganim 3s linear 2s infinite; -moz-animation: bganim 3s linear 2s infinite; -webkit-animation: bganim 3s linear 2s infinite; -o-animation: bganim 3s linear 2s infinite; -ms-animation: bganim 3s linear 2s infinite; } @keyframes bganim { from {background-position:0px;} to { background-position:40px;} } @-moz-keyframes bganim { from {background-position:0px;} to { background-position:40px;} } @-webkit-keyframes bganim { from {background-position:0px;} to { background-position:40px;} } @-o-keyframes bganim { from {background-position:0px;} to { background-position:40px;} } @-ms-keyframes bganim { from {background-position:0px;} to { background-position:40px;} } |
Demo Download Info | Sito Web | Autore
pixolo ads