国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發(fā) > CSS > 正文

CSS3+js實(shí)現(xiàn)簡(jiǎn)單的時(shí)鐘特效

2024-07-11 08:30:09
字體:
供稿:網(wǎng)友

學(xué)習(xí)css3ing,正在學(xué)習(xí)transfomr,突發(fā)奇想用此做個(gè)小時(shí)鐘,開始吧:

準(zhǔn)備前期工作,把時(shí)鐘的表盤,時(shí)分秒針,實(shí)時(shí)時(shí)間標(biāo)簽 的大概樣子做好,效果如圖:


html代碼如下:


復(fù)制代碼
代碼如下:
<div class="main">
<div id="timeLabel"></div>
<div id="hour"></div>
<div id="minute"></div>
<div id="second"></div>
</div>

css 代碼如下:


復(fù)制代碼
代碼如下:
<style>
* {
margin: 0;
padding: 0;
}
.main {
position: relative;
margin: 100px auto;
width: 300px;
height: 300px;
border-radius: 300px;
border: 1px solid #000;
box-shadow:2px 5px;
}
#timeLabel {
position: absolute;
background-color:pink;
width:100px;
height:30px;
left:100px;
top:180px;
}
#hour {
width: 100px;
height: 10px;
background-color: red;
position:absolute;
left:150px;
top:145px;
}
#minute {
width:120px;
height:8px;
background-color:blue;
position:absolute;
left:150px;
top:146px;
}
#second {
width: 140px;
height: 4px;
background-color: green;
position: absolute;
left: 150px;
top: 148px;
}
</style>

  2. 初始化默認(rèn)時(shí)間,和表盤刻度 ,效果如下:

更改后的css代碼:


復(fù)制代碼
代碼如下:
<style>
* {
margin: 0;
padding: 0;
}
.main {
position: relative;
margin: 100px auto;
width: 300px;
height: 300px;
border-radius: 300px;
border: 1px solid #000;
box-shadow: 2px 5px #808080;
}
#timeLabel {
position: absolute;
background-color: pink;
width: 80px;
height: 25px;
left: 110px;
top: 180px;
color: #fff;
line-height: 25px;
text-align: center;
}
#hour {
width: 100px;
height: 10px;
background-color: red;
position: absolute;
left: 150px;
top: 145px;
transform-origin: 0 50%;
}
#minute {
width: 120px;
height: 8px;
background-color: blue;
position: absolute;
left: 150px;
top: 146px;
transform-origin: 0 50%;
}
#second {
width: 140px;
height: 4px;
background-color: green;
position: absolute;
left: 150px;
top: 148px;
transform-origin: 0 50%;
}
.hourPointer, .minuterPointer, .secondPointer {
position: absolute;
transform-origin: 0 50%;
}
.hourPointer {
height: 10px;
width: 12px;
left: 150px;
top: 145px;
background-color: #f00;
z-index:3;
}
.minuterPointer {
height: 8px;
width: 10px;
left: 150px;
top: 146px;
background-color: #b6ff00;
z-index: 2;
}
.secondPointer {
height: 6px;
width: 8px;
left: 150px;
top: 147px;
background-color: #fa8;
z-index: 1;
}
</style>
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 杭锦旗| 阿城市| 稷山县| 台山市| 饶阳县| 即墨市| 武清区| 尚志市| 金溪县| 丘北县| 新营市| 保山市| 班戈县| 广昌县| 建湖县| 南宫市| 康平县| 炉霍县| 敖汉旗| 安远县| 柘荣县| 邵阳县| 肇州县| 修水县| 明光市| 林芝县| 叶城县| 千阳县| 磐石市| 乳山市| 南澳县| 佛教| 隆化县| 横山县| 高雄市| 蓝田县| 福清市| 治多县| 新河县| 治多县| 吴川市|