找回密码
 注册
广告投放 虚位以待【阿里云】2核2G云新老同享 99元/年,续费同价做网站就用糖果主机-sugarhosts.comJtti.com-新加坡服务器,美国服务器,香港服务器
查看: 432|回复: 2

用css实现的BAR图表

[复制链接]
发表于 2005 年 12 月 12 日 00:03:00 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

×
你相信以下的BAR图表是用CSS实现的吗?
1. [attachment=10764]
  1. <style>
  2.   .graph {
  3.       position: relative; /* IE is dumb */
  4.       width: 200px;
  5.       border: 1px solid #B1D632;
  6.       padding: 2px;
  7.   }
  8.   .graph .bar {
  9.       display: block;
  10.       position: relative;
  11.       background: #B1D632;
  12.       text-align: center;
  13.       color: #333;
  14.       height: 2em;
  15.       line-height: 2em;           
  16.   }
  17.   .graph .bar span { position: absolute; left: 1em; }</style> <div class="graph"> <strong class="bar" style="width: 24%;">24%</strong>
  18. </div>
复制代码


2. [attachment=10765]
  1. <style>
  2.   dl {
  3.       margin: 0;
  4.       padding: 0;                    
  5.   }
  6.   dt {
  7.       position: relative; /* IE is dumb */
  8.       clear: both;
  9.       display: block;
  10.       float: left;
  11.       width: 104px;
  12.       height: 20px;
  13.       line-height: 20px;
  14.       margin-right: 17px;              
  15.       font-size: .75em;
  16.       text-align: right;
  17.   }
  18.   dd {
  19.       position: relative; /* IE is dumb */
  20.       display: block;                 
  21.       float: left;     
  22.       width: 197px;
  23.       height: 20px;
  24.       margin: 0 0 15px;
  25.       background: url("g_colorbar.jpg");
  26.    }
  27.    * html dd { float: none; }
  28.   /* IE is dumb; Quick IE hack, apply favorite filter methods for
  29.   wider browser compatibility */
  30.    dd div {
  31.       position: relative;
  32.       background: url("g_colorbar2.jpg");
  33.       height: 20px;
  34.       width: 75%;
  35.       text-align:right;
  36.    }
  37.    dd div strong {
  38.       position: absolute;
  39.       right: -5px;
  40.       top: -2px;
  41.       display: block;
  42.       background: url("g_marker.gif");
  43.       height: 24px;
  44.       width: 9px;
  45.       text-align: left;
  46.       text-indent: -9999px;
  47.       overflow: hidden;
  48.    }
  49. </style>
  50. <dl>
  51.   <dt>Love Life</dt>
  52.   <dd>
  53.       <div style="width:25%;"><strong>25%</strong></div>
  54.   </dd>
  55.   <dt>Education</dt>
  56.   <dd>
  57.       <div style="width:55%;"><strong>55%</strong></div>
  58.   </dd>
  59.   <dt>War Craft 3 Rank</dt>
  60.   <dd>
  61.       <div style="width:75%;"><strong>75%</strong></div>
  62.   </dd>
  63. </dl>
复制代码


3. [attachment=10766]
  1. <style>
  2.   #vertgraph {                    
  3.       width: 378px;
  4.       height: 207px;
  5.       position: relative;
  6.       background: url("g_backbar.gif") no-repeat;
  7.   }
  8.   #vertgraph ul {
  9.       width: 378px;
  10.       height: 207px;
  11.       margin: 0;
  12.       padding: 0;
  13.   }
  14.   #vertgraph ul li {  
  15.       position: absolute;
  16.       width: 28px;
  17.       height: 160px;
  18.       bottom: 34px;
  19.       padding: 0 !important;
  20.       margin: 0 !important;
  21.       background: url("g_colorbar3.jpg") no-repeat !important;
  22.       text-align: center;
  23.       font-weight: bold;
  24.       color: white;
  25.       line-height: 2.5em;
  26.   }
  27.   #vertgraph li.critical { left: 24px; background-position: 0px bottom !important; }
  28.   #vertgraph li.high { left: 101px; background-position: -28px bottom !important; }
  29.   #vertgraph li.medium { left: 176px; background-position: -56px bottom !important; }
  30.   #vertgraph li.low { left: 251px; background-position: -84px bottom !important; }
  31.   #vertgraph li.info { left: 327px; background-position: -112px bottom !important; }
  32. </style>
  33. <div id="vertgraph">
  34.   <ul>
  35.       <li class="critical" style="height: 150px;">22</li>
  36.       <li class="high" style="height: 80px;">7</li>
  37.       <li class="medium" style="height: 50px;">3</li>
  38.       <li class="low" style="height: 90px;">8</li>
  39.       <li class="info" style="height: 40px;">2</li>
  40.   </ul>
  41. </div>
复制代码
Jgwy.Com - Free Web Hosting Guide & Directory In China since 2001! Jgwy.Net-Jglt.Net
发表于 2005 年 12 月 12 日 14:29:25 | 显示全部楼层
【腾讯云】2核2G云服务器新老同享 99元/年,续费同价
第一个可以显示,后2个显示不了啊
Jgwy.Com - Free Web Hosting Guide & Directory In China since 2001! Jgwy.Net-Jglt.Net
回复

使用道具 举报

 楼主| 发表于 2005 年 12 月 12 日 00:03:00 | 显示全部楼层

用css实现的BAR图表

你相信以下的BAR图表是用CSS实现的吗?
1. [attachment=10764]
  1. <style>
  2.   .graph {
  3.       position: relative; /* IE is dumb */
  4.       width: 200px;
  5.       border: 1px solid #B1D632;
  6.       padding: 2px;
  7.   }
  8.   .graph .bar {
  9.       display: block;
  10.       position: relative;
  11.       background: #B1D632;
  12.       text-align: center;
  13.       color: #333;
  14.       height: 2em;
  15.       line-height: 2em;           
  16.   }
  17.   .graph .bar span { position: absolute; left: 1em; }</style> <div class="graph"> <strong class="bar" style="width: 24%;">24%</strong>
  18. </div>
复制代码


2. [attachment=10765]
  1. <style>
  2.   dl {
  3.       margin: 0;
  4.       padding: 0;                    
  5.   }
  6.   dt {
  7.       position: relative; /* IE is dumb */
  8.       clear: both;
  9.       display: block;
  10.       float: left;
  11.       width: 104px;
  12.       height: 20px;
  13.       line-height: 20px;
  14.       margin-right: 17px;              
  15.       font-size: .75em;
  16.       text-align: right;
  17.   }
  18.   dd {
  19.       position: relative; /* IE is dumb */
  20.       display: block;                 
  21.       float: left;     
  22.       width: 197px;
  23.       height: 20px;
  24.       margin: 0 0 15px;
  25.       background: url("g_colorbar.jpg");
  26.    }
  27.    * html dd { float: none; }
  28.   /* IE is dumb; Quick IE hack, apply favorite filter methods for
  29.   wider browser compatibility */
  30.    dd div {
  31.       position: relative;
  32.       background: url("g_colorbar2.jpg");
  33.       height: 20px;
  34.       width: 75%;
  35.       text-align:right;
  36.    }
  37.    dd div strong {
  38.       position: absolute;
  39.       right: -5px;
  40.       top: -2px;
  41.       display: block;
  42.       background: url("g_marker.gif");
  43.       height: 24px;
  44.       width: 9px;
  45.       text-align: left;
  46.       text-indent: -9999px;
  47.       overflow: hidden;
  48.    }
  49. </style>
  50. <dl>
  51.   <dt>Love Life</dt>
  52.   <dd>
  53.       <div style="width:25%;"><strong>25%</strong></div>
  54.   </dd>
  55.   <dt>Education</dt>
  56.   <dd>
  57.       <div style="width:55%;"><strong>55%</strong></div>
  58.   </dd>
  59.   <dt>War Craft 3 Rank</dt>
  60.   <dd>
  61.       <div style="width:75%;"><strong>75%</strong></div>
  62.   </dd>
  63. </dl>
复制代码


3. [attachment=10766]
  1. <style>
  2.   #vertgraph {                    
  3.       width: 378px;
  4.       height: 207px;
  5.       position: relative;
  6.       background: url("g_backbar.gif") no-repeat;
  7.   }
  8.   #vertgraph ul {
  9.       width: 378px;
  10.       height: 207px;
  11.       margin: 0;
  12.       padding: 0;
  13.   }
  14.   #vertgraph ul li {  
  15.       position: absolute;
  16.       width: 28px;
  17.       height: 160px;
  18.       bottom: 34px;
  19.       padding: 0 !important;
  20.       margin: 0 !important;
  21.       background: url("g_colorbar3.jpg") no-repeat !important;
  22.       text-align: center;
  23.       font-weight: bold;
  24.       color: white;
  25.       line-height: 2.5em;
  26.   }
  27.   #vertgraph li.critical { left: 24px; background-position: 0px bottom !important; }
  28.   #vertgraph li.high { left: 101px; background-position: -28px bottom !important; }
  29.   #vertgraph li.medium { left: 176px; background-position: -56px bottom !important; }
  30.   #vertgraph li.low { left: 251px; background-position: -84px bottom !important; }
  31.   #vertgraph li.info { left: 327px; background-position: -112px bottom !important; }
  32. </style>
  33. <div id="vertgraph">
  34.   <ul>
  35.       <li class="critical" style="height: 150px;">22</li>
  36.       <li class="high" style="height: 80px;">7</li>
  37.       <li class="medium" style="height: 50px;">3</li>
  38.       <li class="low" style="height: 90px;">8</li>
  39.       <li class="info" style="height: 40px;">2</li>
  40.   </ul>
  41. </div>
复制代码
Jgwy.Com - Free Web Hosting Guide & Directory In China since 2001! Jgwy.Net-Jglt.Net
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|金光论坛

GMT+8, 2025 年 2 月 1 日 06:46 , Processed in 0.108641 second(s), 21 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表