2008-11-13 25 views

回答

1

將條形圖作爲背景圖像並放置它們以顯示值。例如。與100px的固定的列寬:

<div style="background: url(bg.gif) -50px 0 no-repeat;">5</div> 
<div style="background: url(bg.gif) -20px 0 no-repeat;">8</div> 

如果你的列必須是靈活的尺寸(不固定,並在頁面產生的時間不知道),這是一個有點棘手:

<style type="text/css"> 
    .cell { position: relative; } 
    .cell .back { position: absolute; z-index: 1; background: url(bg.gif); } 
    .cell .value { position: relative; z-index: 2; } 
</style> 

<div class="cell"> 
    <div class="back" style="width: 50%;">&nbsp;</div> 
    <div class="value">5</div> 
</div> 
<div class="cell"> 
    <div class="back" style="width: 80%;">&nbsp;</div> 
    <div class="value">8</div> 
</div> 
相關問題