Advertisement
citstudio

Dynamic PHP ProgressBar

Apr 16th, 2012
377
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.77 KB | None | 0 0
  1. <?php
  2. function progressBar($percentage) {
  3.     print "<div id=\"progress-bar\" class=\"all-rounded\">\n";
  4.     print "<div id=\"progress-bar-percentage\" class=\"all-rounded\" style=\"width: $percentage%\">";
  5.         if ($percentage > 5) {print "$percentage%";} else {print "<div class=\"spacer\">&nbsp;</div>";}
  6.     print "</div></div>";
  7. }
  8. ?>
  9. <style type="text/css">
  10. .all-rounded {
  11.     -webkit-border-radius: 5px;
  12.     -moz-border-radius: 5px;
  13.     border-radius: 5px;
  14. }
  15.  
  16. .spacer {
  17.     display: block;
  18. }
  19.  
  20. #progress-bar {
  21.     width: 300px;
  22.     margin: 0 auto;
  23.     background: #cccccc;
  24.     border: 3px solid #f2f2f2;
  25. }
  26.  
  27. #progress-bar-percentage {
  28.     background: #3063A5;
  29.     padding: 5px 0px;
  30.     color: #FFF;
  31.     font-weight: bold;
  32.     text-align: center;
  33. }
  34. </style>
  35. <?php progressBar(90); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement