css3 立体时钟翻页
导读:CSS3是前端开发中最为重要的一环,在不断地更新和发展中,不断地为前端开发带来更多的可能性。立体时钟翻页就是CSS3中的一项重要功能,在网页设计中相当受喜爱。.clock {position: relative;width: 200px;h...
CSS3是前端开发中最为重要的一环,在不断地更新和发展中,不断地为前端开发带来更多的可能性。立体时钟翻页就是CSS3中的一项重要功能,在网页设计中相当受喜爱。
.clock { position: relative; width: 200px; height: 200px; margin: 0 auto; transform-style: preserve-3d; // 使得元素支持 3D变换,元素变换将不影响子元素} // 小时圆圈.dot { position: absolute; top: 50%; left: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; background-color: #fff; border-radius: 50%; } // 时针样式.hour-hand { position: absolute; top: 50%; left: 50%; width: 6px; height: 60px; margin: -60px 0 0 -3px; background-color: #666; transform-origin: 50% 100%; // 指定变换中心点} // 分针样式.minute-hand { position: absolute; top: 50%; left: 50%; width: 4px; height: 80px; margin: -80px 0 0 -2px; background-color: #999; transform-origin: 50% 100%; } // 秒针样式.second-hand { position: absolute; top: 50%; left: 50%; width: 2px; height: 100px; margin: -100px 0 0 -1px; background-color: #f00; transform-origin: 50% 100%; animation: rotate 60s linear infinite; } // 动画效果,使得秒针每一分钟转一圈@keyframes rotate { to { transform: rotateZ(360deg); } }
通过上述代码,我们可以制作出一个简单的立体时钟效果,让网页设计更加生动。
声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942#qq.com核实处理,我们将尽快回复您,谢谢合作!
若转载请注明出处: css3 立体时钟翻页
本文地址: https://pptw.com/jishu/568734.html