温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

怎么用纯CSS实现美观大方的网页柱状图效果

发布时间:2022-02-28 14:37:11 来源:亿速云 阅读:399 作者:小新 栏目:web开发

小编给大家分享一下怎么用纯CSS实现美观大方的网页柱状图效果,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!

代码如下:

<!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>
<title>CSS柱状图</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
body {padding:0;margin:40px;font-size:9pt;font-family:Helvetica,Geneva,sans-serif;}
h4 {font-weight:normal;display:block;width:600px;text-align:center;}
ul#q-graph {
border:2px solid #0063be;
background:#adfe12 url(http://files.jb51.net/file_images/article/201505/2015512160152351.png) repeat-x scroll 0 0 !important;
background:#adfe12 repeat-x scroll 0 0;
height:300px !important;
height:304px;
width:600px;
position:relative;
list-style:none;
margin:1.1em 1em 3.5em;
padding:0;
}
#q-graph li {
position:absolute;
text-align:center;
bottom:0;
padding:0
margin:0;
}</p><p> li.qtr {
width:150px;
height:300px;
border-right:1px dotted #41a3e2;
z-index:2;
}
li#q1 {left:0;}
li#q2 {left:150px;}
li#q3 {left:300px;}
li#q4 {left:450px;border-right:none;}</p><p> #q-graph ul {list-style:none;}</p><p> li.bar {
width:34px;
color:#fff;
}
li.north {
left:36px;
background:#ddd url(http://files.jb51.net/file_images/article/201505/2015512155936873.gif) no-repeat 0 0;
}
li.south {
left:80px;
background:#ddd url(http://files.jb51.net/file_images/article/201505/2015512155936873.gif) no-repeat -34px 0;
}</p><p> li#ticks {
left:0;
height:300px;
width:100%;
z-index:1;
}
div.ticks {
position:relative;
height:60px;
border-top:1px dotted #41a3e2;
}
div.ticks:first-child {border-top:none;} 
div.ticks p {
position:absolute;
left:103%;
top:-11pt;
}
</style>
</head>
<body>
<ul id="q-graph">
<li id="q1" class="qtr">Q1
<ul>
<li class="north bar" style="height:111px;">20</li>
<li class="south bar" style="height:99px;">11</li>
</ul></li>
<li id="q2" class="qtr">Q2
<ul>
<li class="north bar" style="height:198px;">50</li>
<li class="south bar" style="height:210px;">39</li>
</ul></li>
<li id="q3" class="qtr">Q3
<ul>
<li class="north bar" style="height:260px;">48</li>
<li class="south bar" style="height:198px;">26</li>
</ul></li>
<li id="q4" class="qtr">Q4
<ul>
<li class="north bar" style="height:111px;">36</li>
<li class="south bar" style="height:198px;">22</li>
</ul></li>
<li id="ticks">
<div class="ticks"><p>60</p></div>
<div class="ticks"><p>37</p></div>
<div class="ticks"><p>32</p></div>
<div class="ticks"><p>19</p></div>
</li>
</ul>
</body>
</html>

看完了这篇文章,相信你对“怎么用纯CSS实现美观大方的网页柱状图效果”有了一定的了解,如果想了解更多相关知识,欢迎关注亿速云行业资讯频道,感谢各位的阅读!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

css
AI