你的位置:首页 > 网页设计

[网页设计]纯CSS制作液晶屏的显示效果


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html <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 >
<div ><div ></div><div ></div></div>
<div ><div ></div><div ></div></div>
<div ><div ></div><div ></div></div>
<div ><div ></div><div ></div></div>
<div ><div ></div><div ></div></div>
<div ><div ></div><div ></div></div>
<div ><div ></div><div ></div></div>
</div>
</div>
<input type="button" value="改变大小" onclick="resize()" />
<input type="button" value="数字累加" onclick="addNumber()" />
<div>http://www.999jiujiu.com/</div>
</body>
</html>