[css] 使用css画个钟表的时间刻度

[css] 使用css画个钟表的时间刻度

写一下思路,先定义一个钟表的大小位置,用absolute,从1点到12点用ul,li。每个li可以用nth-child(对应第几个)来控制位置,角度用transform,然后分钟的刻度也是照样子分别控制位置,要用48个li,这个就要慢慢算了。<div id="watch"><ul class="minute-marks"><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li></ul><ul class="digits"><li>1</li><li>2</li><li>3</li><li>4</li><li>5</li><li>6</li><li>7</li><li>8</li><li>9</li><li>10</li><li>11</li><li>12</li></ul>
</div>
ul { list-style:none; margin:0; padding:0 }#watch .minute-marks li {display:block;width:.2em;height:.6em;background:#929394;position:absolute;top:50%; left:50%;margin:-.4em 0 0 -.1em;
}
#watch .minute-marks li:first-child {transform:rotate(6deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(2) {transform:rotate(12deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(3) {transform:rotate(18deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(4) {transform:rotate(24deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(5) {transform:rotate(36deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(6) {transform:rotate(42deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(7) {transform:rotate(48deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(8) {transform:rotate(54deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(9) {transform:rotate(66deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(10) {transform:rotate(72deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(11) {transform:rotate(78deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(12) {transform:rotate(84deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(13) {transform:rotate(96deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(14) {transform:rotate(102deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(15) {transform:rotate(108deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(16) {transform:rotate(114deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(17) {transform:rotate(126deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(18) {transform:rotate(132deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(19) {transform:rotate(138deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(20) {transform:rotate(144deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(21) {transform:rotate(156deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(22) {transform:rotate(162deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(23) {transform:rotate(168deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(24) {transform:rotate(174deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(25) {transform:rotate(186deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(26) {transform:rotate(192deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(27) {transform:rotate(198deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(28) {transform:rotate(204deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(29) {transform:rotate(216deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(30) {transform:rotate(222deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(31) {transform:rotate(228deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(32) {transform:rotate(234deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(33) {transform:rotate(246deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(34) {transform:rotate(252deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(35) {transform:rotate(258deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(36) {transform:rotate(264deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(37) {transform:rotate(276deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(38) {transform:rotate(282deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(39) {transform:rotate(288deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(40) {transform:rotate(294deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(41) {transform:rotate(306deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(42) {transform:rotate(312deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(43) {transform:rotate(318deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(44) {transform:rotate(324deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(45) {transform:rotate(336deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(46) {transform:rotate(342deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(47) {transform:rotate(348deg) translateY(-12.7em)}
#watch .minute-marks li:nth-child(48) {transform:rotate(354deg) translateY(-12.7em)}
#watch .digits {width:30em;height:30em;border-radius:15em;position:absolute;top:0; left:50%;margin-left:-15em;
}
#watch .digits li {font-size:1.6em;display:block;width:1.6em;height:1.6em;position:absolute;top:50%; left:50%;line-height:1.6em;text-align:center;margin:-.8em 0 0 -.8em;font-weight:bold;
}
#watch .digits li:nth-child(1) { transform:translate(3.9em, -6.9em) }
#watch .digits li:nth-child(2) { transform:translate(6.9em, -4em) }
#watch .digits li:nth-child(3) { transform:translate(8em, 0) }
#watch .digits li:nth-child(4) { transform:translate(6.8em, 4em) }
#watch .digits li:nth-child(5) { transform:translate(3.9em, 6.9em) }
#watch .digits li:nth-child(6) { transform:translate(0, 8em) }
#watch .digits li:nth-child(7) { transform:translate(-3.9em, 6.9em) }
#watch .digits li:nth-child(8) { transform:translate(-6.8em, 4em) }
#watch .digits li:nth-child(9) { transform:translate(-8em, 0) }
#watch .digits li:nth-child(10) { transform:translate(-6.9em, -4em) }
#watch .digits li:nth-child(11) { transform:translate(-3.9em, -6.9em) }
#watch .digits li:nth-child(12) { transform:translate(0, -8em) }

个人简介

我是歌谣,欢迎和大家一起交流前后端知识。放弃很容易,
但坚持一定很酷。欢迎大家一起讨论

主目录

与歌谣一起通关前端面试题

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/413423.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

BZOJ 2301 - Problem b(莫比乌斯反演+容斥)

题目链接 https://cn.vjudge.net/problem/HYSBZ-2301 【题意】 对于给出的 n 个询问&#xff0c;每次求有多少个数对(x,y)(x,y) &#xff0c;满足 a≤x≤b&#xff0c;c≤y≤da≤x≤b&#xff0c;c≤y≤d &#xff0c;且 gcd(x,y)k&#xff0c;gcd(x,y)gcd(x,y)k&#xff0c;g…

前端两个经典bug

1、margin塌陷bug <!DOCTYPE html> <html lang"en"> <head><meta charset"UTF-8"><meta name"viewport" content"widthdevice-width, initial-scale1.0"><meta http-equiv"X-UA-Compatible&qu…

[css] 请使用css3实现图片的平滑转换

[css] 请使用css3实现图片的平滑转换 以全局监听的方式通过 a 标签的描点进行 view 动态切换页面&#xff0c;只要把 a 标签带有 id 的 href 属性的值指到锚点&#xff0c;用 CSS3 的动画进行切换页面.个人简介 我是歌谣&#xff0c;欢迎和大家一起交流前后端知识。放弃很容易…

== vs === in Javascript

本文来自网易云社区作者&#xff1a;魏文庆如果你只想知道与的区别&#xff0c;请直接看总结&#xff0c;当然我更希望您能耐心看完全文。Javascript中用于相等比较的操作符有两个和。我们通常称为“等于”&#xff0c;而我们通常称为“严格等于”。本文将对和做详细说明。相对…

[css] 使用纯css能否监控到用户的一些信息?怎么实现?

[css] 使用纯css能否监控到用户的一些信息&#xff1f;怎么实现&#xff1f; 利用:active 伪类实现监控用户的点击 .button-1:active::after {content: url(./pixel.gif?actionclick&idbutton1);display: none; } .button-2:active::after {content: url(./pixel.gif?ac…

hive 动态分区实现 (hive-1.1.0)

hive 动态分区实现 &#xff08;hive-1.1.0&#xff09; 笔者使用的hive版本是hive-1.1.0 hive-1.1.0动态分区的默认实现是只有map没有reduce,通过执行计划就可以看出来。&#xff08;执行计划如下&#xff09; insert overwrite table public_t_par partition(delivery_dateke…

浏览器的组成

外壳shell&#xff1a;User Interface&#xff08;用户界面&#xff09;、Browser engine&#xff08;浏览器引擎&#xff09;、Networking&#xff08;网络&#xff09;、UI Backend&#xff08;UI 后端&#xff09;、Date Persistence&#xff08;数据持久化存储&#xff09;…

[css] css的加载会阻塞js运行吗?为什么?

[css] css的加载会阻塞js运行吗&#xff1f;为什么&#xff1f; 会阻塞js的执行&#xff0c;因为js可能会去获取或改变元素的样式&#xff0c;所以浏览为了不重复渲染&#xff0c; 等所有的css加载渲染完成后在执行js个人简介 我是歌谣&#xff0c;欢迎和大家一起交流前后端知…

JS基础知识点总结

NaN 与任何值相比较 都是false (包括它自己 如NaN NaN >false)&#xff0c;可以理解为它连自己的不认识parseInt("123abc") 计算机是从头到尾读字符串&#xff0c;如果不是数字就截断&#xff0c;直接返回parseFloat同理num 123.1456789 num.toFixed(3…

[css] css的加载会阻塞DOM树解析和渲染吗?为什么

[css] css的加载会阻塞DOM树解析和渲染吗&#xff1f;为什么 css的加载不会阻止DOM树的解析 css的加载会阻止DOM树的渲染&#xff0c;因为css的下载完成后解析成CSSOM与DOM生成渲染树后&#xff0c;页面才会渲染&#xff0c;绘制出来个人简介 我是歌谣&#xff0c;欢迎和大家…

0901

下拉刷新一万赞&#xff1a;https://github.com/scwang90/SmartRefreshLayout git上搜索&#xff1a;refreshLayouthttps://github.com/search?odesc&qrefreshLayout&sstars&typeRepositories SwipeRefreshLayout pullRefresh XRecyclerView转载于:https://www.cn…

jQuery Validate 前端校验

参考自&#xff1a;https://www.runoob.com/jquery/jquery-plugin-validate.html 建议&#xff1a;将引入的js&#xff0c;jQuery&#xff0c;css文件下载到自己的本地或者远程服务器 否则&#xff1a;如果您的网站使用了SSL证书请求的安全策略&#xff0c;注意引用的文件是否…

[css] 异步加载CSS的方式有哪些?

[css] 异步加载CSS的方式有哪些&#xff1f; 异步加载CSS 说到加载 CSS 这种事儿不是很简单吗&#xff1f;像这样咯&#xff1a; 这不就完事儿了嘛&#xff01; 这样是没错&#xff01;但是这样有问题啊——会阻塞渲染&#xff01;浏览器看到这个标签就会停下手里的活儿&…

Golang 垃圾回收机制

1. Golang GC 发展 Golang 从第一个版本以来&#xff0c;GC 一直是大家诟病最多的。但是每一个版本的发布基本都伴随着 GC 的改进。下面列出一些比较重要的改动。 v1.1 STWv1.3 Mark STW, Sweep 并行v1.5 三色标记法v1.8 hybrid write barrier2. GC 算法简介  这一小节介绍三…

Bootstrap FileInput(文件上传)中文API整理

下载地址、API和DOM地址&#xff08;英语好的小伙伴可以看看&#xff09; 下载地址&#xff1a;https://github.com/kartik-v/bootstrap-fileinput API文档 &#xff1a;http://plugins.krajee.com/file-input D E M O&#xff1a;http://plugins.krajee.com/file-input/demo …

[css] 举例说明如何从html元素继承box-sizing?

[css] 举例说明如何从html元素继承box-sizing&#xff1f; html{box-sizing:border-box;}*,*:before,*:after{box-sizing:inherit;}个人简介 我是歌谣&#xff0c;欢迎和大家一起交流前后端知识。放弃很容易&#xff0c; 但坚持一定很酷。欢迎大家一起讨论 主目录 与歌谣一起…

Configutation读取properties文件信息

commons configuration可以很方便的访问配置文件和xml文件中的的内容。Commons Configuration 是为了提供对属性文件、XML文件、JNDI资源、来自JDBC Datasource数据的访问。 官方文档&#xff1a;http://commons.apache.org/proper/commons-configuration/ 我们研究configurati…

JavaScript 所有数据类型

JavaScript 所有数据类型 在 JavaScript 中有 5 种不同的数据类型&#xff1a; stringnumberbooleanobjectfunction 3 种对象类型&#xff1a; ObjectDateArray 2 个不包含任何值的数据类型&#xff1a; nullundefined 可以使用 typeof 操作符来查看 JavaScript 变量的数据…

[css] 使用css的attr()写一个类似a标签title的提示框

[css] 使用css的attr()写一个类似a标签title的提示框 .box{position:relative;}.box:hover{content: attr(data-title); display: inline-block;padding: 10px 14px;border: 1px solid #ddd;border-radius: 5px;position: absolute;top: -50px;left: -10px;}个人简介 我是歌…

JavaScript 严格模式(use strict)

使用 "use strict" 指令 "use strict" 指令在 JavaScript 1.8.5 (ECMAScript5) 中新增。 它不是一条语句&#xff0c;但是是一个字面量表达式&#xff0c;在 JavaScript 旧版本中会被忽略。 "use strict" 的目的是指定代码在严格条件下执行。…