With CSS3 Border-radius, Box-shadow, Transition,-moz-linear-gradient,-webkit-gradient and other styles can be completed a fashion progress bar, Here, let's take a look at a few CSS3. Sample code to make a color progress bar style share:
First, the production of static purple stripe progress bar
HTML code:
<body><p class= "Progress-bar purple" > <span style= "width:40%;" ></span> </p></body>
CSS code:
Body {background-color: #333; }. Progress-bar {background-color: #222; border-radius:3px; width:300px; height:24px; padding:5px; margin:50px; border-bottom:1px solid #444; Box-shadow:inset 0 0 2px 0 #000; }. progress-bar span {display:inline-block; width:140px; height:24px; border-radius:2px; box-shadow:0 1px 0 Rgba (255, 255, 255, 0.5) inset; -moz-box-shadow:0 1px 0 Rgba (255, 255, 255, 0.5) inset; -webkit-box-shadow:rgba (255,255,255,0.5) 0 1px 0 inset; }. Purple span{background-color: #F09; Background-image:-moz-linear-gradient (45deg, Rgba (255, 255, 255, 0.3) 25%, transparent 25%, transparent 50%, RGBA (255, 25 5, 255, 0.3) 50%, RGBA (255, 255, 255, 0.3) 75%, transparent 75%); Background-image:-webkit-gradient (linear,0 100%,100% 0,color-stop (25%,rgba (255,255,255,0.3)), Color-stop (25%, Transparent), Color-stop (50%,transparent), Color-stop (50%,rgba (255,255,255,0.3)), Color-stop (75%,rgba ( 255,255,255,0.3)), Color-stop (75%,Transparent)); BACKGROUND-SIZE:16PX 16px; }
The final effect looks like this:
Second, the production of static Blue progress bar
HTML code:
<p class= "Progress-bar orange" > <span style= "width:60%;" ></span> </p>
CSS code:
. Orange span{ background-image:-webkit-gradient (linear,0% 0%,0% 100%,from (#fecd22), to (#fd9415)); Background-image:-moz-linear-gradient ( -90deg, #fecd22, #fd9415); }
The final effect looks like this:
Third, the production of static green progress bar
HTML code:
<p> <span style= "width:80%;" ></span> </p>
CSS code:
. Green span{ background-color: #00ff24; Box-shadow:rgba (255,255,255,0.7) 0 5px 5px Inser,rgba (255,255,255,0.7) 0-5px 5px inset; -webkit-box-shadow:rgba (255, 255, 255, 0.7) 0 5px 5px inset, Rgba (255, 255, 255, 0.7) 0-5px 5px inset; -moz-box-shadow:rgba (255, 255, 255, 0.7) 0 5px 5px inset, Rgba (255, 255, 255, 0.7) 0-5px 5px inset; }
The final effect looks like this:
Iv. adding dynamic effects to purple stripes
CSS code:
. Purple span:hover{ -webkit-animation:animate-stripes 3s linear infinite; -moz-animation:3s linear 0s normal none infinite animate-stripes; } @-webkit-keyframes Animate-stripes { 0% {background-position:0 0;} 100% {background-position:60px 0;} } @-moz-keyframes Animate-stripes { 0% {background-position:0 0;} 100% {background-position:60px 0;} }
After the mouse is put on, the dynamic effect will appear.