Connecting Tech Pros Worldwide Forums | Help | Site Map

percentage indicator

SK
Guest
 
Posts: n/a
#1: Jul 20 '05
How to achieve this*? Percentage number is always in
the middle of the table. If needed, the number is overlayed
over the cell border (for example, in case of "55%").
Thanks,

-----------------------------------
| | |
| | 35% |
| | |
-----------------------------------


-----------------------------------
| | |
| 75% | |
| | |
-----------------------------------


* For viewing, non-proportional font required.





Thomas Mlynarczyk
Guest
 
Posts: n/a
#2: Jul 20 '05

re: percentage indicator


Also sprach SK:
[color=blue]
> How to achieve this*? Percentage number is always in
> the middle of the table. If needed, the number is overlayed
> over the cell border (for example, in case of "55%").[/color]

Quick, dirty and tested only on IE5:

<div id="progress">
<div id="done"></div>
<div id="percent">55%</div>
</div>

#progress {
position:relative;
width:200px;
border:1px solid black;
}

#done {
width:55%;
background-color:green;
}

#percent {
position:absolute;
top:0;
left:90px;
color:red;
}

Drawback: the percentage is not exactly in the middle, but maybe you can
improve this code.

Greetings,
Thomas



SK
Guest
 
Posts: n/a
#3: Jul 20 '05

re: percentage indicator


[snip]

Great, exactly what I need. Thanks.


Closed Thread