You could use one div and an image, as I mentioned earlier in a comment. Here's a way you could do it. (Not completely tested, so it may break.)
HTML:
<div id="progressBar"></div>
CSS:
#progressBar {
width: 200px;
height: 20px;
background: url('http://o.imm.io/x9E.jpg') no-repeat;
background-position: -200px 0px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
}
JS:
function setProgress(target,value) {
var oldPosition = $(target).css("backgroundPosition");
// Log the old position
console.log("Old position: " + oldPosition);
var newPosition = parseInt(oldPosition) + parseInt(value);
// Log the new position
console.log("New position: " + newPosition);
$(target).animate({backgroundPosition: newPosition + 'px 0px'})
}
Edit: I added the rounded corners and it works exactly as you specified, no issues with the rounded corners.
Edit 2: Check out the JSBin version of this code.
Edit 3: As the OP said, they needed the progress bar to be flexibly sized. This implementation won't do that. I'm going to recommend (as I have earlier) the use of the jQueryUI Progress Bar. It's easy to use, and fairly lightweight.
Edit 4: I've come up with another implementation of this, which requires a bit more Javascript, but you can test it out here: http://jsfiddle.net/ntnz4/7/