
常用软件类: |
|杀毒安全 | |联络聊天 | |网络软件 | |多媒体类 | |系统工具 | |图形图像 | |系统工具 | |应用软件 | |行业软件 |
开发设计类: |
|动画制作 | |图像处理 | |3D设计 | |操作系统 | |站长学院 | |网络相关 | |WEB设计 | |数据库类 | |程序开发 |
百度搜藏|
新浪VIvi|
365key|
Younote|
搜狐 |
博采中心|
你好BLOG|
亿友网摘|
网摘博客|
POCO网摘|
和讯网摘|
CSS基本条状图表的实现方法是什么?我们看下面的实例介绍:
| 以下是引用片段: <div class="graph"> <strong class="bar" style="width: 24%;">24%</strong> </div> |
这是xhtml代码,定义了一个容器,应用类graph,其中包括了一个xhtml元素strong,并且对这个元素应用类bar。
我们看下面的CSS定义:
| 以下是引用片段: .graph { position: relative; /* IE is dumb */ width: 200px; border: 1px solid #B1D632; padding: 2px; } .graph .bar { display: block; position: relative; background: #B1D632; text-align: center; color: #333; height: 2em; line-height: 2em; } .graph .bar span { position: absolute; left: 1em; } |
通过上面的边框,颜色的定义,我们勾勒出了一个条状的图形,我们在xhtml代码中style="width: 24%;",定义了所设置的区域既大小。这样一个基本的条状图表就完成了!
全部代码:
| 以下是引用片段: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>homepage.yesky.com</title> <style type="text/css"> .graph { position: relative; /* IE is dumb */ width: 200px; border: 1px solid #B1D632; padding: 2px; } .graph .bar { display: block; position: relative; background: #B1D632; text-align: center; color: #333; height: 2em; line-height: 2em; } .graph .bar span { position: absolute; left: 1em; } </style> </head> <body> <div class="graph"> <strong class="bar" style="width: 24%;">24%</strong> </div> <br /> <div class="graph"> <strong class="bar" style="width: 60%;">60%</strong> </div> </body> </html> |