CSS實現柱狀圖其實很簡單

來源:互聯網
上載者:User

 

仁兄司徒正美在這裡提到了CSS實現柱狀圖的方法: http://www.cnblogs.com/rubylouvre/archive/2009/08/08/1541914.html

這裡給出我的實現,其實沒有那麼複雜,請看代碼

Code
<!doctype html>
<head>
<style>
ul.chart{padding:0;margin:0;list-style:none;border:1px #ccc solid;height:255px;font-size:9pt;background:#ddf3ff}
ul.chart p{padding:0;margin:0}
ul.chart .title{text-align:center;height:25px;line-height:25px;}
ul.chart li{width:80px;float:left;padding:0;}
ul.chart li:hover{background:#f7f7f7;}
ul.chart .total{height:230px;position:relative;}
ul.chart .percent{background:#f0f;width:20px;position:absolute;left:25px;bottom:0;}
</style>
</head>
<body>
<ul class=chart>
<li><p class=title>最終幻想</p><div class=total><p class=percent style="height:50%;">50%</p></div></li>
<li><p class=title>星之海樣</p><div class=total><p class=percent style="height:10%;">10%</p></div></li>
<li><p class=title>白騎士</p><div class=total><p class=percent style="height:70%;">70%</p></div></li>
</ul>
</body>
相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.