CSS实现柱状图其实很简单

仁兄司徒正美在这里提到了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><class=title>最终幻想</p><div class=total><class=percent style="height:50%;">50%</p></div></li>
<li><class=title>星之海样</p><div class=total><class=percent style="height:10%;">10%</p></div></li>
<li><class=title>白骑士</p><div class=total><class=percent style="height:70%;">70%</p></div></li>
</ul>
</body>
原文地址:https://www.cnblogs.com/XiaoG/p/1543389.html