Skip to content

Commit 03909cb

Browse files
author
Maggie Costello Wachs
committed
added examples of labels offset from the left side, FG's recommendation for best workaround re: label position, requires no extra markup and max flexibility
1 parent bd96035 commit 03909cb

2 files changed

Lines changed: 34 additions & 5 deletions

File tree

tests/static/progressbar.html

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,43 @@
33
<head>
44
<title>jQuery UI Progressbar Static Markup Test Page</title>
55
<link rel="stylesheet" href="../../themes/base/ui.all.css" type="text/css">
6+
<style type="text/css">
7+
h2 { margin:1.5em 0 .5em; }
8+
</style>
69
</head>
710
<body>
811

912
<h1>jQuery UI Progressbar Static Markup Test Page</h1>
1013

14+
<h2>Flexible width:</h2>
15+
1116
<div class="ui-progressbar ui-widget ui-widget-content ui-corner-all" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="13">
1217
<div class="ui-progressbar-label">13% Completed</div>
13-
<div class="ui-progressbar-value ui-state-default ui-corner-left" style="width: 13%;"><span class="ui-progressbar-label">13% Completed</span></div>
18+
<div class="ui-progressbar-value ui-state-default ui-corner-left" style="width:13%;"><div class="ui-progressbar-label">13% Completed</div></div>
19+
</div>
20+
21+
<br /><br/>
22+
23+
<!-- users can set a left offset in px, %, ems, whatever to move the label along the axis -->
24+
25+
<div class="ui-progressbar ui-widget ui-widget-content ui-corner-all" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="55">
26+
<div class="ui-progressbar-label" style="left:350px;">55% Completed</div>
27+
<div class="ui-progressbar-value ui-state-default ui-corner-left" style="width:55%"><div class="ui-progressbar-label" style="left:350px;">55% Completed</div></div>
28+
</div>
29+
30+
<br /><br/>
31+
32+
<div class="ui-progressbar ui-widget ui-widget-content ui-corner-all" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="55">
33+
<div class="ui-progressbar-label" style="left:600px;">55% Completed</div>
34+
<div class="ui-progressbar-value ui-state-default ui-corner-left" style="width:55%"><div class="ui-progressbar-label" style="left:600px;">55% Completed</div></div>
35+
</div>
36+
37+
38+
<h2>Fixed width (px):</h2>
39+
40+
<div style="width:500px" class="ui-progressbar ui-progressbar-fixed ui-widget ui-widget-content ui-corner-all" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="78">
41+
<div class="ui-progressbar-label">78% Completed</div>
42+
<div class="ui-progressbar-value ui-state-default ui-corner-left" style="width:78%"><div class="ui-progressbar-label">78% Completed</div></div>
1443
</div>
1544

1645
</body>

themes/base/ui.progressbar.css

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* Progressbar
22
----------------------------------*/
3-
.ui-progressbar { position: relative; }
4-
.ui-progressbar-label {position: absolute; top: 0; left: 0; padding: .4em .5em; border: 0; background: none; }
5-
.ui-progressbar-value { position: relative; margin: -1px; padding: .4em .5em; overflow: hidden; font-weight: normal !important; white-space: nowrap; }
6-
.ui-progressbar-value .ui-progressbar-label { position: static; padding: 0; top: auto; left: auto; }
3+
.ui-progressbar { position: relative; overflow:hidden; }
4+
.ui-progressbar, .ui-progressbar-value { height:1em; padding:.4em 0 .5em; }
5+
.ui-progressbar-label { position: absolute; left:0; top: .3em; text-indent: .5em; border: 0; background: none; white-space: nowrap; }
6+
.ui-progressbar-value { position: absolute; top:0; width:100%; margin: -1px; overflow: hidden; font-weight: normal !important; white-space: nowrap; }

0 commit comments

Comments
 (0)