Reputation: 5677
How can i append text
before
and after
the progress-bar.
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-git.js"></script>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css" rel="stylesheet">
<title>JS Bin</title>
</head>
<body>
<div class="progress">
<div class="progress-bar" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 60%;">
<span class="show">60% Complete</span>
</div>
</div>
</body>
</html>
Below is the jsbin i am working on. http://jsbin.com/IBOwEPog/219/edit
Upvotes: 0
Views: 1750
Reputation: 927
If you're cool with using jQuery, you can use the prepend
and append
methods.
$('.progress').append("Text Before").prepend("Text After");
Upvotes: 0
Reputation: 394
May have got the wrong idea on this but this makes the 2 spans of text appear on either side of the progress bar.
Both spans are now outside of the progress div.
margin-left on the progress bar gives space for the left-hand side text
Hope this helps
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-git.js"></script>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css" rel="stylesheet">
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
<span id="analysis_volume" class="show">Analysis Volume</span>
<div class="progress">
<div class="progress-bar" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 60%;">
</div>
<span id="usage" class="show"> 60% Complete</span>
</div>
</body>
</html>
/**
* Progress bars with centered text
*/
.progress {
position: relative;
margin-left:110px;
}
#analysis_volume {
position: absolute;
display: block;
text-align:left;
width: 100%;
color: black;
}
Upvotes: 0