使用CSS3纯代码来实现模拟时钟,及指针动画功能。
在这里主要使用到css3一些基本元素:
border-radius:圆角边框,画圆形;表盘
Transform:变换,旋转,扭曲;刻度盘,指针形状
Animation:时分秒指针转动。
:before/:after :伪元素

基本思路:

  1. <div id="clock" class="">
  2. <ul>
  3. <li class="kedu"></li>
  4. <li class="kedu"></li>
  5. <li class="kedu"></li>
  6. <li class="kedu"></li>
  7. <li class="kedu"></li>
  8. <li class="kedu"></li>
  9. <li class="kedu"></li>
  10. <li class="kedu"></li>
  11. <li class="kedu"></li>
  12. <li class="kedu"></li>
  13. <li class="shzi s3">3</li>
  14. <li class="shzi s6">6</li>
  15. <li class="shzi s9">9</li>
  16. <li class="shzi s12">12</li>
  17. <li class="hh"></li>
  18. <li class="mm"></li>
  19. <li class="ss"></li>
  20. <li class="ms"></li>
  21. <li class="biaopan"></li>
  22. <li class="biaozhou"></li>
  23. <li class="logo"></li>
  24. </ul>
  25. </div>

-----------------------
1.使用div+css画圆来定义时钟底盘,使用其伪类:before和:after,相当于增加两个容器,用于设计表盘轮廓或定位线;使用border-radius属性设计圆形。


图1.使用伪元素将一个div变为三个可用的容器。

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title> new document </title>
  5. <meta charset="utf-8" />
  6.  
  7. <style type="text/css">
  8. #clock{
  9. position:absolute;
  10. width:50px;
  11. height:50px;
  12. background:#000;
  13. border-radius:10px;
  14. }
  15. #clock:before{
  16. content:" ";
  17. position:absolute;
  18. top:20px;
  19. left:20px;
  20. width:50px;
  21. height:50px;
  22. background:#0f0;
  23. border-radius:20px;
  24. }
  25. #clock:after{
  26. content:" ";
  27. position:absolute;
  28. top:40px;
  29. left:40px;
  30. width:50px;
  31. height:50px;
  32. background:#f0f;
  33. border-radius:100%;
  34. border-radius:25px;
  35. }
  36.  
  37. </style>
  38. </head>
  39.  
  40. <body>
  41. <div id="clock" class=""> </div>
  42. </body>
  43. </html>

2.使用li的block属性设计两端的边框来定义时钟的60个刻度。设置li的上下边框线使其成为2个刻度,使用li的伪类:before和:after,分别增加2个刻度;即时,1个li元素就可以定义3个层块6个刻度。所以,需要10个li来完成60十个刻度。
  <style type="text/css">
 .Numerals{
 display:inline-block;
 width:3px;height:351px;
 top:11px;left:203px;
 border-top:15px solid #000;
 border-bottom:15px solid #000;
 }

</style>
  <ul>
 <li class="Numerals"></li>
 <li></li>
  </ul>
然后通过旋转完成60个刻度。

3.定义指针:li为指针主体,li:before和li:after来定义指针头部和尾部(矩形变形为菱形transform:rotate(-45deg) skew(-30deg,-30deg);,矩形3角圆角为水滴型border-radius:100% 0 100% 100%;)

4.指针动画:定位好表轴位置(旋转点)transform-origin:2px 100%;然后设计秒针分针时针的旋转动画即可:秒针每秒跳一格6度,60秒360度;分针12秒跳一格6度,3600秒360度;时针可以设计为连续走、每秒跳或按格跳、按半格跳等。

.hourHand{ animation:anim_hr 43200s linear infinite; }
.minuteHand{ animation:anim_min 3600s  steps(60) infinite; }
.secondHand{ animation:anim_sec 60s steps(60) infinite; }

@keyframes anim_sec{
 from{transform:rotate(0deg) ;}
 to{ transform:rotate(360deg) ;}
}
@keyframes anim_min{
 to{ transform:rotate(360deg) ;}
}
@keyframes anim_hr{
 to{ transform:rotate(360deg) ;}
}

5.细节处理:表盘样式、logo、浏览器兼容性等。

6.效果图:

7.全部代码:/*---------------20150915---------------*/

  1. <!DOCTYPE html>
  2. <html >
  3. <head>
  4. <title> 飛天网事-纯CSS模拟时钟+js对时。 </title>
  5. <meta charset="utf-8" />
  6. <meta name="description" content="飛天网事,WEB前端开发,纯css3代码时钟精彩案例" />
  7. <meta name="keywords" content="飛天网事,WEB前端开发,HTML5,CSS3,jQuery," />
  8. <meta name="author" content="R.tian @eduppp.cn 2015">
  9. <meta name="viewport" content="width=device-width,initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" />
  10. <meta name="apple-mobile-web-app-capable" content="yes" />
  11. <meta name="apple-mobile-web-app-status-bar-style" content="white" />
  12. <meta content="telephone=no" name="format-detection" />
  13. <link rel="shortcut icon" type="image/x-icon" href="/web/css/eduppp.ico" />
  14. <link rel="shortcut icon" type="image/x-icon" href="/images/logo4.gif" />
  15. <link rel="apple-touch-icon" href="/images/logo.gif" />
  16. <link rel="apple-touch-icon" sizes="72x72" href="/images/logo.gif" />
  17. <link rel="apple-touch-icon" sizes="114x114" href="/images/logo.gif" />
  18. <style type="text/css">
  19. #main{width:375px;height:375px;margin:auto;}
  20. #clockDial{/*--------底盘-------------*/
  21. position:absolute;z-index:100;
  22. width:401px;
  23. height:401px;
  24. background:#333;
  25. border-radius:100%;
  26. box-shadow:0 0 15px #000;
  27. -webkit-transform:scale(0.6);
  28. }
  29. /*--------底盘--纵横定位线(调试用)-----------*/
  30. /*#clockDial:before{
  31. content:" ";
  32. position:absolute;
  33. width:3px;left:202px;
  34. height:351px;top:26px;
  35. background:#0000ff;
  36. }
  37. #clockDial:after{
  38. content:" ";
  39. position:absolute;
  40. width:3px;left:202px;
  41. height:351px;top:26px;
  42. background:#0000ff;
  43. transform:rotate(90deg);
  44. }*/
  45. #clockDial:before{/*--------底盘--边框外阴影-----------*/
  46. content:" ";
  47. position:absolute;
  48. width:442px;left:-21px;
  49. height:442px;top:-21px;
  50. border-radius:100%;
  51. box-shadow:0 0 30px #000;*/
  52. }/**/
  53. #clockDial:after{/*--------底盘--边框-----------*/
  54. content:" ";
  55. position:absolute;
  56. width:440px;left:-20px;
  57. height:440px;top:-20px;
  58. border-radius:100%;
  59. box-shadow:0 0 20px 10px #003366 inset;
  60. }/**/
  61. .Numerals{display:inline-block;z-index:3;}
  62. .Numerals{/*--------10个刻度线 * 两端----主标签-------*/
  63. position:absolute;
  64. width:3px;height:351px;
  65. top:11px;left:203px;
  66. border-top:15px solid #fff;
  67. border-bottom:15px solid #fff;
  68. box-shadow:0 0 10px 1px #0000ff;
  69. transform-origin:50% 50%;
  70. -webkit-transform-origin:50% 50%;
  71. }
  72. .Numerals:before{/*--------10个刻度线 * 两端----副标签-------*/
  73. content:" ";
  74. position:absolute;
  75. width:3px;height:351px;
  76. top:-15px;
  77. border-top:15px solid #fff;
  78. border-bottom:15px solid #fff;
  79. transform:rotate(60deg);
  80. -webkit-transform:rotate(60deg);
  81. box-shadow:0 0 10px 1px #0000ff;
  82. transform-origin:50% 50%;
  83. -webkit-transform-origin:50% 50%;
  84. }
  85. .Numerals:after{/*--------10个刻度线 * 两端-----副标签------*/
  86. content:" ";
  87. position:absolute;
  88. width:3px;height:351px;
  89. top:-15px;left:0px;
  90. border-top:15px solid #fff;
  91. border-bottom:15px solid #fff;
  92. border-left:0px;
  93. border-right:0px;
  94. transform:rotate(120deg);
  95. -webkit-transform:rotate(120deg);
  96. box-shadow:0 0 10px 1px #0000ff;
  97. transform-origin:50% 50%;
  98. -webkit-transform-origin:50% 50%;
  99. }
  100. /*--------10个刻度线 * 3线 * 两端 ---方位-----------*/
  101. .Numerals:nth-child(2){
  102. transform:rotate(6deg);-webkit-transform:rotate(6deg);
  103. }
  104. .Numerals:nth-child(3){
  105. transform:rotate(12deg);-webkit-transform:rotate(12deg);
  106. }
  107. .Numerals:nth-child(4){transform:rotate(18deg);-webkit-transform:rotate(18deg); }
  108. .Numerals:nth-child(5){transform:rotate(24deg);-webkit-transform:rotate(24deg); }
  109. .Numerals:nth-child(6){transform:rotate(30deg);-webkit-transform:rotate(30deg); }
  110. .Numerals:nth-child(7){transform:rotate(36deg);-webkit-transform:rotate(36deg); }
  111. .Numerals:nth-child(8){transform:rotate(42deg); -webkit-transform:rotate(42deg); }
  112. .Numerals:nth-child(9){transform:rotate(48deg); -webkit-transform:rotate(48deg); }
  113. .Numerals:nth-child(10){transform:rotate(54deg);-webkit-transform:rotate(54deg); }
  114. .Num{z-index:10;}
  115. #clockFace{z-index:5;}
  116. #pivot{z-index:11;}
  117. #clockFace{/*--------表盘-----------*/
  118. display:block;position:absolute;opacity:0.9;
  119. top:30px;left:32px;
  120. width:343px;height:343px;
  121. background:#333;
  122. border-radius:100%;
  123. }
  124. #clockFace:before{/*--------12/6刻度-----------*/
  125. content:" ";
  126. display:block;position:absolute;
  127. width:7px;height:322px;left:50%;top:50%;
  128. margin:-191px 0 0 -3px;
  129. border-top:30px solid #fff;
  130. border-bottom:30px solid #fff;
  131. }
  132. #clockFace:after{/*--------3/9刻度-----------*/
  133. content:" ";
  134. display:block;position:absolute;
  135. width:7px;height:322px;left:50%;top:50%;
  136. margin:-191px 0 0 -3px;
  137. border-top:30px solid #fff;
  138. border-bottom:30px solid #fff;
  139. transform:rotate(90deg);
  140. }
  141. .Num{/*--------3、6、9、12数字位置-----------*/
  142. z-index:9;
  143. display:block;position:absolute;
  144. left:50%;top:50%;font-size:22pt;color:#fff;
  145. }
  146. .num3{margin:-15px 0 0 150px}
  147. .num6{margin:130px 0 0 -5px}
  148. .num9{margin:-15px 0 0 -155px}
  149. .num12{margin:-165px 0 0 -10px}
  150. /*--------其他数字位置-----------*/
  151. .num3:before{content:"1";font-size:16pt;
  152. margin:-140px 0 0 -70px;display:block;position:absolute; }
  153. .num3:after{content:"2";font-size:16pt;
  154. margin:-110px 0 0 -10px;display:block;position:absolute; }
  155. .num6:before{content:"4";font-size:16pt;
  156. margin:-60px 0 0 145px;display:block;position:absolute; }
  157. .num6:after{content:"5";font-size:16pt;
  158. margin:-35px 0 0 85px;display:block;position:absolute; }
  159. .num9:before{content:"7";font-size:16pt;
  160. margin:145px 0 0 70px;display:block;position:absolute; }
  161. .num9:after{content:"8";font-size:16pt;
  162. margin:52px 0 0 12px;display:block;position:absolute; }
  163. .num12:before{content:"10";font-size:16pt;
  164. margin:70px 0 0 -140px;display:block;position:absolute; }
  165. .num12:after{content:"11";font-size:16pt;
  166. margin:-20px 0 0 -80px;display:block;position:absolute; }
  167. /*--------表轴原点--------------------------------------------*/
  168. #pivot {
  169. z-index:90;
  170. display:block;position:absolute; left:50%;top:50%;
  171. margin:-5px 0 0 -2px;
  172. width:11px;height:11px;
  173. border-radius:5px;
  174. background:#fff;
  175. box-shadow:0 0 10px 1px #ff0 ;
  176. }
  177. /*----------------时针-------------------------------------------*/
  178. #hourHand{/*--------时针:主线-----------*/
  179. z-index:10;
  180. display:block;position:absolute;
  181. left:50%;top:50%;margin:-100px 0 0 0;
  182. width:7px;height:136px;
  183. background:#ff0; box-shadow:0 0 10px #000;
  184. opacity:0.7;
  185. transform-origin:50% 101px;
  186. -webkit-transform-origin:50% 101px;
  187. }
  188. #hourHand:after{/*--------时针:头-----------*/
  189. content:" ";display:block;position:absolute; left:3px;top:-10px;
  190. width:20px;height:20px;
  191. border-radius:0px 0;
  192. transform-origin:0 100%;
  193. -webkit-transform-origin:0 100%;
  194. transform:rotate(-45deg) skew(-20deg,-20deg);
  195. -webkit-transform:rotate(-45deg) skew(-20deg,-20deg);
  196. background:#ff0;
  197. }
  198. #hourHand:before{/*--------时针:尾-----------*/
  199. content:" ";display:block;position:absolute; left:2px;top:120px;
  200. width:20px;height:20px;
  201. border-radius:100% 0 100% 100%;
  202. transform-origin:4px 100%;
  203. -webkit-transform-origin:4px 100%;
  204. transform:rotate(-45deg) ;
  205. -webkit-transform:rotate(-45deg) ;
  206. background:#ff0;box-shadow:0 0 10px #000;
  207. }
  208. /*---------------分针--------------------------------------------*/
  209. #minuteHand{/*--------分针:主线-----------*/
  210. z-index:10;
  211. display:block;position:absolute;
  212. left:50%;top:50%;margin:-120px 0 0 1px;
  213. width:5px;height:156px;
  214. background:#0f0; box-shadow:0 0 10px #000;
  215. opacity:0.6;
  216. transform-origin:50% 121px;
  217. -webkit-transform-origin:50% 121px;
  218. }
  219. #minuteHand:after{/*--------分针:头-----------*/
  220. content:" ";display:block;position:absolute; left:2px;top:-10px;
  221. width:20px;height:20px;
  222. border-radius:0px 0;
  223. transform-origin:0 100%;
  224. -webkit-transform-origin:0 100%;
  225. transform:rotate(-45deg) skew(-30deg,-30deg);
  226. -webkit-transform:rotate(-45deg) skew(-30deg,-30deg);
  227. background:#0f0;
  228. }
  229. #minuteHand:before{/*--------分针:尾-----------*/
  230. content:" ";display:block;position:absolute; left:2px;top:150px;
  231. width:20px;height:20px;
  232. border-radius:100% 0 100% 100%;
  233. transform-origin:2px 100%;
  234. -webkit-transform-origin:2px 100%;
  235. transform:rotate(-45deg) ;
  236. -webkit-transform:rotate(-45deg) ;
  237. background:#0f0;box-shadow:0 0 10px #000;
  238. }
  239. /*-----------------秒针------------------------------------------*/
  240. #secondHand{/*--------秒针:主线-----------*/
  241. z-index:10;
  242. display:block;position:absolute;
  243. left:50%;top:50%;margin:-140px 0 0 2px;
  244. width:3px;height:176px;
  245. background:#f00; box-shadow:0 0 10px #000;
  246. opacity:0.7;
  247. transform-origin:50% 141px;
  248. -webkit-transform-origin:50% 141px;
  249. }
  250. #secondHand:after{/*--------秒针:头-----------*/
  251. content:" ";display:block;position:absolute; left:2px;top:-10px;
  252. width:30px;height:30px;
  253. border-radius:5px 0;
  254. transform-origin:0 100%;
  255. -webkit-transform-origin:0 100%;
  256. transform:rotate(-45deg) skew(-30deg,-30deg);
  257. -webkit-transform:rotate(-45deg) skew(-30deg,-30deg);
  258. background:#f00;
  259. }
  260. #secondHand:before{/*--------秒针:尾-----------*/
  261. content:" ";display:block;position:absolute; left:1px;top:180px;
  262. width:20px;height:20px;
  263. border-radius:100% 0 100% 100%;
  264. transform-origin:2px 100%;
  265. -webkit-transform-origin:2px 100%;
  266. transform:rotate(-45deg) ;
  267. -webkit-transform:rotate(-45deg) ;
  268. background:#f00;box-shadow:0 0 10px #000;
  269. }
  270. /*--------动画:指针----(使用JavaScript脚本対时)-----------------------------------*/
  271. /*
  272. #hourHand{ animation:anim_hr 43200s linear infinite; }
  273. #minuteHand{ animation:anim_min 3600s steps(60) infinite; }
  274. #secondHand{ animation:anim_sec 60s steps(60) infinite; }
  275. @keyframes anim_sec{
  276. from{transform:rotate(0deg) ;}
  277. to{ transform:rotate(360deg) ;}
  278. }
  279. @keyframes anim_min{
  280. to{ transform:rotate(360deg) ;}
  281. }
  282. @keyframes anim_hr{
  283. to{ transform:rotate(360deg) ;}
  284. }
  285. */
  286. /*-----------------------------------------------------------*/
  287. #millisecond{/*--------毫秒小盘-----------*/
  288. z-index:9;
  289. display:block;position:absolute;
  290. left:50%;left:50%;
  291. margin:220px 0 0 -38px;
  292. width:80px;height:80px;
  293. border:1px dashed #fff;
  294. border-radius:100%;
  295. background:#555;
  296. opacity:0.3;
  297. box-shadow:0 0 10px 1px #fff inset;
  298. }
  299. #millisecond:after{/*--------毫秒:指针----------*/
  300. content:" ";
  301. display:block;position:absolute;
  302. margin:4px 0 0 37px;
  303. width:3px;height:35px;
  304. border:1px dashed #990099;
  305. background:#9900cc;
  306. border-radius:100%;
  307. opacity:1.5;
  308. }
  309. #millisecond:after{/*--------毫秒:动画----------*/
  310. transform-origin:50% 35px;
  311. -webkit-transform-origin:50% 35px;
  312. animation:anim_l 1s linear infinite;
  313. -webkit-animation:anim_l 1s linear infinite;
  314. }
  315. @keyframes anim_l{
  316. from{ transform:rotate(0deg) ; -webkit-transform:rotate(0deg) ;}
  317. to{ transform:rotate(360deg) ; -webkit-transform:rotate(360deg) ;}
  318. }
  319. /*-----------------------------------------------------------*/
  320. #logo{
  321. position:absolute;z-index:8;
  322. left:191px;top:80px;
  323. display:inline;
  324. color:#fff;
  325. font-size:25px;
  326. opacity:1;
  327. }
  328. #logo:before{
  329. content:"eduppp.cn";
  330. display:block;position:absolute;font-family:"方正舒体" ;
  331. left:50%;top:50%;margin:5px 0 0 -38px;
  332. color:#fff;
  333. opacity:0.8;
  334. font-size:20px;
  335. }
  336. #logo:after{
  337. content:"Copyright @R.tian 2015";
  338. display:block;position:absolute;
  339. margin:210px 0 0 -45px;
  340. width:150px;
  341. border:0px solid #cc3300;
  342. color:#fff;
  343. font-size:12px;
  344. opacity:0.6;
  345. }
  346. #face{z-index:8;
  347. position:absolute;
  348. left:80px;
  349. top:75px;
  350. width:250px;
  351. height:250px;
  352. border:0px solid #09c;
  353. background:#0099ff;
  354. border-radius:40px;
  355. border-radius:40px;
  356. opacity:0.1;
  357. }
  358. #face:before{content:" ";
  359. position:absolute;
  360. width:250px;
  361. height:250px;
  362. border:0px solid #00c;
  363. background:#0099ff;
  364. transform:rotate(60deg);
  365. border-radius:40px;
  366. -webkit-transform:rotate(60deg);
  367. }
  368. #face:after{content:" ";
  369. position:absolute;
  370. width:250px;
  371. height:250px;
  372. border:0px solid #a9c;
  373. background:#0099ff;
  374. border-radius:40px;
  375. transform:rotate(120deg);
  376. -webkit-transform:rotate(120deg);
  377. }
  378. </style>
  379. <script type="text/javascript">
  380. //----使用Js控制动画时间,每秒对三个指针定位。
  381. //----CSS3的动画animation,使用js对时后无法达到三个指针同步(0秒时,三针同时旋转)。
  382. /**/
  383. window.onload=function() {//当文档加载完成时执行该代码。
  384. var clock = new Clock();
  385. clock.start();
  386. };
  387. function Clock() {
  388. var d = new Date();
  389. var h = d.getHours() % 12;
  390. var m = d.getMinutes();
  391. var s = d.getSeconds();
  392. this.start = function() {
  393. var clock = new Clock();
  394. document.getElementById("secondHand").style.webkitTransform="rotate("+s*6+"deg)";
  395. document.getElementById("minuteHand").style.webkitTransform="rotate("+m*6+"deg)";
  396. document.getElementById("hourHand").style.webkitTransform="rotate("+( h*30+parseInt(m/6)*3 )+"deg)";
  397. document.getElementById("secondHand").style.transform="rotate("+s*6+"deg)";
  398. document.getElementById("minuteHand").style.transform="rotate("+m*6+"deg)";
  399. document.getElementById("hourHand").style.transform="rotate("+( h*30+parseInt(m/6)*3 )+"deg)";
  400. window.setTimeout(function() {clock.start();}, 500);
  401. };
  402. }
  403. </script>
  404. </head>
  405. <body>
  406. <div id="main" class="">
  407. <div id="clockDial" class="">
  408. <ul>
  409. <li class="Numerals"></li>
  410. <li class="Numerals"></li>
  411. <li class="Numerals"></li>
  412. <li class="Numerals"></li>
  413. <li class="Numerals"></li>
  414. <li class="Numerals"></li>
  415. <li class="Numerals"></li>
  416. <li class="Numerals"></li>
  417. <li class="Numerals"></li>
  418. <li class="Numerals"></li>
  419. <li class="Num num3">3</li>
  420. <li class="Num num6">6</li>
  421. <li class="Num num9">9</li>
  422. <li class="Num num12">12</li>
  423. <li id="hourHand"></li>
  424. <li id="minuteHand"></li>
  425. <li id="secondHand"></li>
  426. <li id="millisecond"></li>
  427. <li id="clockFace"></li>
  428. <li id="logo"></li>
  429. <li id="pivot"></li>
  430. <li id="face"></li>
  431. </ul>
  432. </div>
  433. </div>
  434. </body>
  435. </html>

--------------------- 本文来自 rtian001 的CSDN 博客 ,全文地址请点击:https://blog.csdn.net/rtian001/article/details/48684247?utm_source=copy

【CSS3】纯CSS代码实现模拟时钟,+js对时功能。的更多相关文章

  1. [刘阳Java]_纯CSS代码实现内容过滤效果

    继续我们技术专题课,我们今天给大家带来的是一个比较酷炫的"纯CSS代码实现内容过滤效果",没有加入任何JS的效果.全部都是应用CSS3的新增选择器来实现的.先看效果截图 实现思路 ...

  2. css3 - 纯css实现一个轮播图

    这是我上一次的面试题.一晃两个月过去了. 从前都是拿原理骗人,把怎么实现的思路说出来. 我今天又被人问到了,才想起来真正码出来.码出来效果说明一切: 以上gif,只用到了5张图片,一个html+css ...

  3. 纯css代码写旋转动画

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  4. 使用纯css代码实现div的“回”字型“叠放”效果

    正如大家所知道的那样,div是一个块级元素,也是网页编写过程中使用频率最高的一个元素,通过不同的样式控制可以实现一些最常见的页面效果,当然也可以实现一些比较复杂的页面效果,这里就展示一个本人面试过程中 ...

  5. 页面元素固定在页面底部的纯css代码(兼容IE6)

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  6. 分享一段css代码学到的js知识

    [].forEach.call($$('*'),function(val){ val.style.outline = '1px solid #'+(~~(Math.random()*(1<< ...

  7. 纯CSS实现箭头、气泡让提示功能具有三角形图标(简单实例)

    <style type="text/css"> /*向上箭头,类似A,只有三个边,不能指定上边框*/ .arrow-up { width: 0px; height: 0 ...

  8. 纯CSS实现轮播图效果,你不知道的CSS3黑科技

    前言 轮播图已经是一个很常见的东西,尤其是在各大App的首页顶部栏,经常会轮番显示不同的图片. 一提到轮播图如何实现时,很多人的第一反应就是使用Javascript的定时器,当然这种方法是可以实现的. ...

  9. 纯css实现checkbox开关切换按钮

    我们都知道 checkbox 标签默认样式 实在是太low了,故对CheckBox美化很有必要. 现提供两种方式对其进行美化. 方法一 <div class="switch-wrap ...

随机推荐

  1. VMware虚拟机安装Ubuntu系统英文改中文的方法

    首先点击右上角的这个桌面 1,Change Desktop Background   图片发自简书App 2.到系统设置(System Settings)--- 点击Language Support ...

  2. thinkCMF----自定义配置调用

    有些时候,需要在后台给网站一些其他的配置: 这个配置,一般都是通过修改代码实现的,ThinkCMF本身没有这个配置: 找到site.html 增加一个Group就可以: 在配置里面做相应的配置就可以:

  3. thinkCMF----路由跳转

    使用ThinkCMF的时候,在模板界面上,可能会用到一些自定义路由,ThinkCMF路由的基本配置与用法: ThinkCMF自带有路由美化的功能: 这种路由都是当你创建栏目或创建文章的时候,自动生成的 ...

  4. hdu2586(LCA最近公共祖先)

    How far away ? Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) T ...

  5. 9.5Django

    2018-9-5 15:23:00 配置数据库信息  setting MySQLdb 不支持python3 创建表 pycharm 连接数据库 好强大的赶脚

  6. OpenCV Create Circular Mask 圆形遮罩

    在OpenCV中,比较常见的是矩形遮罩CvRect,没有专门提供圆形的mask,那么我们只能自己写一个来模拟圆形mask的函数,需要提供的参数为原图的大小,以及圆形mask的圆心位置和半径即可,返回一 ...

  7. OpenCV Save CvRect to File 保存CvRect变量到文件

    在OpenCv中,我们有时候需要查看CvRect变量的值,我们可以通过将其保存到文件来查看,保存的代码如下: void writeCvRectToFile(CvRect &rect, cons ...

  8. idea启动tomcat后访问项目报java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet

    一.报错“java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet” 1.File --- ...

  9. PL/SQL常用表达式及举例(一)

    IF 判断条件 THEN 满足条件时执行语句 END IF; DECLARE v_countResult NUMBER; BEGIN SELECT COUNT(empno) INTO v_countR ...

  10. Connections in Galaxy War----zoj3261

    题目链接: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3261 题意:有n个星球编号为0—n-1;能量分别为p[i]:有 ...