首页 技术 正文
技术 2022年11月19日
0 收藏 1000 点赞 3,160 浏览 2353 个字
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<style id="css">
#wrap{
width: 200px;
height: 200px;
border: 1px solid #000;
border-radius: 50%;
margin: 100px auto;
position: relative;
}
#wrap ul{
margin: 0;padding: 0;
height: 200px;
list-style: none;
position: relative;
}
#wrap ul li{
width: 2px;height: 8px;background: #000;
position: absolute;
left: 99px;
top:0;
-webkit-transform-origin: center 100px;
}
/*#wrap ul li:nth-of-type(1){
-webkit-transform: rotate(0deg);
}
#wrap ul li:nth-of-type(2){
-webkit-transform: rotate(6deg);
}
#wrap ul li:nth-of-type(3){
-webkit-transform: rotate(12deg);
}
#wrap ul li:nth-of-type(4){
-webkit-transform: rotate(18deg);
}
#wrap ul li:nth-of-type(5){
-webkit-transform: rotate(24deg);
}
#wrap ul li:nth-of-type(6){
-webkit-transform: rotate(30deg);
}
#wrap ul li:nth-of-type(7){
-webkit-transform: rotate(36deg);
}
#wrap ul li:nth-of-type(8){
-webkit-transform: rotate(42deg);
}*/
#wrap ul li:nth-of-type(5n+1){
height: 12px;
}
#hour{
width: 6px;
height: 45px;
background: #000;
position: absolute;
left: 97px;
top:55px;
-webkit-transform-origin: bottom;
}
#min{
width: 4px;
height: 65px;
background: #999;
position: absolute;
left: 98px;
top: 35px;
-webkit-transform-origin: bottom;
}
#sec{
width: 2px;
height: 80px;
background: red;
position: absolute;
left: 99px;
top: 20px;
-webkit-transform-origin: bottom;
}
#icon{
width: 20px;height: 20px;
background: #000;
border-radius: 50%;
position: absolute;
left: 90px;
top: 90px;
}
</style>
</head>
<body>
<div id="wrap">
<ul id="list">
<!--<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>-->
</ul>
<div id="hour"></div>
<div id="min"></div>
<div id="sec"></div>
<div id="icon"></div>
</div>
<script>
var oList=document.getElementById('list');
var oCss=document.getElementById('css');
var oHour=document.getElementById('hour');
var oMin=document.getElementById('min');
var oSec=document.getElementById('sec');
var aLi='';
var sCss='';
for(var i= 0;i<60;i++){
sCss+='#wrap ul li:nth-of-type('+(i+1)+'){-webkit-transform: rotate('+i*6+'deg);}';
aLi+='<li></li>';
}
oList.innerHTML=aLi;
oCss.innerHTML+=sCss;
setInterval(toTime,1000);
toTime();
function toTime(){
var oDate=new Date();
var iSec=oDate.getSeconds();
var iMin=oDate.getMinutes()+iSec/60;
var iHour=oDate.getHours()+iMin/60;
oSec.style.WebkitTransform='rotate('+iSec*6+'deg)';
oMin.style.WebkitTransform='rotate('+iMin*6+'deg)';
oHour.style.WebkitTransform='rotate('+iHour*30+'deg)';
}
</script>
</body>
</html>

    

用CSS3写的钟表

  在写的过程中,发现了一个小问题:

  用CSS3写的钟表

  时分秒的顺序不能写错,开始我把时写在最上面,时针和分针怎么都没反映,这是执行顺序的原因吗?

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,076
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,552
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,400
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,176
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,812
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,894