码迷,mamicode.com
首页 > Web开发 > 详细

纯CSS制作液晶屏的显示效果

时间:2015-04-01 22:07:22      阅读:387      评论:0      收藏:0      [点我收藏+]

标签:纯css制作液晶屏的显示效果

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>CSS液晶</title>
<style type="text/css" title="">
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,blockquote,th,td{margin:0;padding:0;}
#mydemo{margin:100px auto;width:600px;}
.clock{font-size:18px;width:9em;height:14em;border:1px solid #ddd;position:relative;}
.clock div{position: absolute;border-style:solid;}
.clock .l,.clock .r,.clock .u,.clock .d{width:0;height:0;overflow:hidden;}
.clock .v{width:0;height:5em;border-width:0 0.5em;border-color:#565656;}
.clock .v .u{border-style:dotted dotted solid dotted;border-width:0 0.5em 0.5em;border-color:transparent transparent #565656 transparent;top:-0.5em;left:-0.5em;}
.clock .v .d{border-style:solid dotted dotted dotted;border-width:0.5em 0.5em 0 0.5em;border-color:#565656 transparent transparent transparent;left:-0.5em;bottom:-0.5em}
.clock .h{width:5.5em;height:0;border-width:0.5em 0;border-color:#565656;}
.clock .h .l{border-style:dotted solid dotted dotted;border-width:0.5em 0.5em 0.5em 0;border-color:transparent #565656 transparent transparent;top:-0.5em;left:-0.5em;}
.clock .h .r{border-style:dotted dotted dotted solid;border-width:0.5em 0 0.5em 0.5em;border-color:transparent transparent transparent #565656;top:-0.5em;right:-0.5em;}
.clock .n1{left:0.5em;top:1.5em;}
.clock .n2{left:0.5em;top:7.5em;}
.clock .n4{left:7.5em;top:7.5em;}
.clock .n5{left:7.5em;top:1.5em;}
.clock .n6{top:0.4em;left:1.8em;}
.clock .n3{top:12.5em;left:1.8em;}
.clock .n7{top:6.5em;left:1.8em;}
.c1 .n1,.c1 .n2,.c1 .n3,.c1 .n6,.c1 .n7{display:none}
.c2 .n1,.c2 .n4{display:none}
.c3 .n1,.c3 .n2{display:none}
.c4 .n2,.c4 .n3,.c4 .n6{display:none}
.c5 .n2,.c5 .n5{display:none}
.c6 .n5{display:none}
.c7 .n1,.c7 .n2,.c7 .n3,.c7 .n7{display:none}
.c8{}
.c9 .n2{display:none}
.c0 .n7{display:none}
</style>
<script type="text/javascript" language="javascript" >
var num=0,size=1;
function addNumber(){
var clock=document.getElementById("mydemo").children[0];
clock.className="clock c"+(++num % 10);
return false;
}
function resize(){
var clock=document.getElementById("mydemo").children[0];
clock.style.fontSize=(++size % 20)+"px";
return false;
}
</script>
</head>
<body>
<div id="mydemo">
<div class="clock c0">
<div class="v n1"><div class="u"></div><div class="d"></div></div>
<div class="v n2"><div class="u"></div><div class="d"></div></div>
<div class="h n3"><div class="l"></div><div class="r"></div></div>
<div class="v n4"><div class="u"></div><div class="d"></div></div>
<div class="v n5"><div class="u"></div><div class="d"></div></div>
<div class="h n6"><div class="l"></div><div class="r"></div></div>
<div class="h n7"><div class="l"></div><div class="r"></div></div>
</div>
</div>
<input type="button" value="改变大小" onclick="resize()" />
<input type="button" value="数字累加" onclick="addNumber()" />
<div><A href="http://www.999jiujiu.com/">http://www.999jiujiu.com/</A></div>
</body>
</html>

纯CSS制作液晶屏的显示效果

标签:纯css制作液晶屏的显示效果

原文地址:http://blog.csdn.net/life66881/article/details/44810905

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!