1

Is it possible to implement a minimal progress-bar that fits into a cell in a table (a 2-color bar with a text on it) in HTML/CSS without Javascript?

A dynamic update of the progress bar is not needed.

Roland Seuhs
  • 1,878
  • 4
  • 27
  • 51

2 Answers2

2

you need javascript to implement dynamic behavior on a page (e.g., if you want to update the progress bar)

of course, you could always try using a META tag in the HEAD to periodically refresh the entire page, and update the progress bar on the server side, like so:

<meta http-equiv="refresh" content="15">

(I'm assuming that by "implement" you mean getting the progress bar to display the current progress)

EDIT: HTML5 includes a new progress tag:

<progress value="10" max="100"></progress>
David J
  • 659
  • 1
  • 9
  • 25
1

Just adjust to your needs: (color, width) Loaded percentage is inline style.

<div class="progress-bar">
  <span class="progress" style="width: 20%;"></span>
  <span class="text">Loading...</span>
</div>

<style type="text/css">
.progress-bar{
  position: relative;
  width: 200px;
  height: 24px;
  background: #bdc3c7;
  border-radius: 5px;
  overflow: hidden;
  font-family: "Arial";
}
.progress-bar .progress{
  z-index: 1;
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: #2ecc71;
}
.progress-bar .text{
  z-index: 2;
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  text-align: center;
  line-height: 24px;
  vertical-align: center;
  color: #2c3e50;
}
</style>