三种CSS图表代码

2016-02-19 14:16 7 1 收藏

想要天天向上,就要懂得享受学习。图老师为大家推荐三种CSS图表代码,精彩的内容需要你们用心的阅读。还在等什么快点来看看吧!

【 tulaoshi.com - Web开发 】

这是最基本的预览,下面是几种不同的应用代码

一、基本的CSS图表

CSS代码

(本文来源于图老师网站,更多请访问https://www.tulaoshi.com/webkaifa/)(本文来源于图老师网站,更多请访问https://www.tulaoshi.com/webkaifa/)

style   
    .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   
div class="graph"   
    strong class="bar" style="width: 24%;"24%/strong   
/div

二、复杂的CSS条形图

CSS代码

(本文来源于图老师网站,更多请访问https://www.tulaoshi.com/webkaifa/)(本文来源于图老师网站,更多请访问https://www.tulaoshi.com/webkaifa/)

style   
    dl {    
        margin: 0;    
        padding: 0;         
    }   
    dt {    
        position: relative; /* IE is dumb */  
        clear: both;   
        display: block;    
        float: left;    
        width: 104px;    
        height: 20px;    
        line-height: 20px;   
        margin-right: 17px;                 
        font-size: .75em;    
        text-align: rightright;    
    }   
    dd {    
        position: relative; /* IE is dumb */  
        display: block;         
        float: left;        
        width: 197px;    
        height: 20px;    
        margin: 0 0 15px;    
        background: url("g_colorbar.jpg");    
     }   
     * html dd { float: none; }    
    /* IE is dumb; Quick IE hack, apply favorite filter methods for   
    wider browser compatibility */  
  
     dd div {    
        position: relative;    
        background: url("g_colorbar2.jpg");    
        height: 20px;    
        width: 75%;    
        text-align:rightright;    
     }   
     dd div strong {    
        position: absolute;    
        rightright: -5px;    
        top: -2px;    
        display: block;    
        background: url("g_marker.gif");    
        height: 24px;    
        width: 9px;    
        text-align: left;   
        text-indent: -9999px;    
        overflow: hidden;   
     }   
/style   
dl   
    dtLove Life/dt   
    dd   
        div style="width:25%;"strong25%/strong/div   
    /dd   
    dtEducation/dt   
    dd   
        div style="width:55%;"strong55%/strong/div   
    /dd   
    dtWar Craft 3 Rank/dt   
    dd   
        div style="width:75%;"strong75%/strong/div   
    /dd   
/dl  

三、CSS竖条图

CSS代码

(本文来源于图老师网站,更多请访问https://www.tulaoshi.com/webkaifa/)(本文来源于图老师网站,更多请访问https://www.tulaoshi.com/webkaifa/)

style   
    #vertgraph {   
        width: 378px;    
        height: 207px;    
        position: relative;    
        background: url("g_backbar.gif") no-repeat;    
    }   
    #vertgraph ul {    
        width: 378px;    
        height: 207px;    
        margin: 0;    
        padding: 0;    
    }   
    #vertgraph ul li {     
        position: absolute;    
        width: 28px;    
        height: 160px;    
        bottombottom: 34px;    
        padding: 0 !important;    
        margin: 0 !important;    
        background: url("g_colorbar3.jpg") no-repeat !important;   
        text-align: center;    
        font-weight: bold;    
        color: white;    
        line-height: 2.5em;   
    }   
  
    #vertgraph li.critical { left: 24px; background-position: 0px  !important; }   
    #vertgraph li.high { left: 101px; background-position: -28px  !important; }   
    #vertgraph li.medium { left: 176px; background-position: -56px  !important; }   
    #vertgraph li.low { left: 251px; background-position: -84px  !important; }   
    #vertgraph li.info { left: 327px; background-position: -112px  !important; }   
/style   
div id="vertgraph"   
    ul   
        li class="critical" style="height: 150px;"22/li   
        li class="high" style="height: 80px;"7/li   
        li class="medium" style="height: 50px;"3/li   
        li class="low" style="height: 90px;"8/li   
        li class="info" style="height: 40px;"2/li   
    /ul   
/div

来源:https://www.tulaoshi.com/n/20160219/1606584.html

延伸阅读
标签: 猪肉
饺子皮椒盐煎饼的做法步骤 1. 准备食材:小葱、饺子皮、色拉油、芝麻、椒盐 2. 饺子皮上均匀刷上油 3. 均匀洒上椒盐(也可放点咖喱) ...
标签: 营养价值
水果在我们的饮食中占据着非常重要的地位,不仅因为水果的口感出色,更重要的是水果的种类非常多,不仅可以满足人们的味蕾,而且水果的营养非常丰富,给我们的身体健康带来很多的好处,所以营养学家一直建议我们每天都要吃水果,那么常吃水果究竟有哪些好处呢? 常吃水果的好处 1、提升肤质 俗话说人靠一张脸,树...
分娩姿势的8种可能 一说到分娩,也许你就会把注意力集中在分娩的疼痛上。我们从世界各地的妇产医院了解到,其实分娩时,还有很多姿势可供你选择。这些姿势可能会让你更舒适,疼痛更少,用更多的精力去体味迎接新生命的愉悦! 胎儿在分娩的过程中,经过产道时,要根据妈妈骨盆的形状旋转,调换适合的角度。妈妈的分娩姿势会直接影响胎儿娩出的...
标签: 南瓜 南瓜饼 美食
南瓜做法多变 南瓜是一种非常平价的蔬菜,但是千万不能够小看了南瓜,因为南瓜里面富含着丰富的营养,多吃南瓜对我们的身体有着很多的好处,而且南瓜的做法有很多,可以随便选择。 很多人比较喜欢吃饼之类的食物,比如说土豆饼南瓜饼等等,其实我们也可以自己利用南瓜在家里面做南瓜饼,而且做法还非常的简单。做南瓜饼我们必须要选...
标签: 生活常识
三种庭院风情打造 本专题中的三个上海庭院,运用三种庭院的打造方法,又结合实际条件,因地制宜,各具风情,值得大家借鉴和学习。 东南亚风情 特色 东南亚庭院最大的特点是最自然的风情,注重对遮阳、通风、采光等问题的解决,且注重对日光和雨水的再利用,从而达到节省能源的效果。所以,外观一般比较通透和清爽,例如百...

经验教程

248

收藏

83
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部