CSS特效005:绘制一个环环相扣的五个环

编程入门 行业动态 更新时间:2024-10-18 03:27:56

CSS<a href=https://www.elefans.com/category/jswz/34/1769013.html style=特效005:绘制一个环环相扣的五个环"/>

CSS特效005:绘制一个环环相扣的五个环

css实战中,怎么制作这样的一个环环相扣的五个环呢? 绘制五个圈圈很容易,关键是要环环相扣,尤其要注意环环相交部分的处理。这里要用到transform-style: preserve-3d; 和 transform: rotateY( 1deg ) 等关键的css技术。

效果图

源代码

/*
* @Author: 大剑师兰特(xiaozhuanlan),还是大剑师兰特(CSDN)
* @此源代码版权归大剑师兰特所有,可供学习或商业项目中借鉴,未经授权,不得重复地发表到博客、论坛,问答,git等公共空间或网站中。
* @Email: 2909222303@qq
* @weixin: gis-dajianshi
* @First published in CSDN
* @First published time: 2023-11-11
*/
<template><div class="container"><div class="top"><h3>绘制一个环环相扣的五环</h3><div class="author">大剑师兰特, 还是大剑师兰特,gis-dajianshi</div></div><div class="dajianshi-rings"><div class="ring"></div><div class="ring"></div><div class="ring"></div><div class="ring"></div><div class="ring"></div></div></div>
</template><style scoped>.container {width: 1000px;height: 580px;margin: 50px auto;border: 1px solid green;position: relative;}.top {margin: 0 auto 0px;padding: 10px 0;background: plum;color: #fff;}.dajianshi-rings {width: 350px;height: 350px;position: relative;margin: 100px auto 0;transform-style: preserve-3d;}.ring {position: absolute;border: 12px solid;width: 100px;height: 100px;border-radius: 50%;}.ring:nth-child(1) {border-color: red;top: 0;left: 0;transform: rotateY( 1deg )/*3D效果,以y轴旋转*/}.ring:nth-child(2) {border-color: black;top: 0px;left: 130px;transform: rotateY( 1deg )}.ring:nth-child(3) {border-color: red;top: 0px;left: 260px;transform: rotateY( 1deg )}.ring:nth-child(4) {border-color: yellow;top: 60px;left: 60px;transform: rotateY( -1deg )}.ring:nth-child(5) {border-color: yellow;top: 60px;left: 190px;transform: rotateY( -1deg )}
</style>

更多推荐

CSS特效005:绘制一个环环相扣的五个环

本文发布于:2023-11-15 11:38:26,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1598949.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:环环相扣   特效   CSS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!