Hello!小伙伴!
首先很是感谢您阅读海轰的文章,假若文中有错误的地方,欢迎您指出~
哈哈 自我介绍一下
昵称:海轰
标签:程序猿一只|C++选手|学生
简介:因C语言结识编程,随后转入计算机专业,有幸拿过国奖、省奖等,已保研。目前正在学习C++/Linux(真的真的太难了~)
学习经验:扎实基础 + 多作笔记 + 多敲代码 + 多思考 + 学好英语!
平常分享:微信公众号【海轰Pro】记录生活、学习点滴,分享一些源代码或者学习资料,欢迎关注~css
HTMLhtml
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="style.css"> <title>Document</title> </head> <body> <section><span></span></section> </body> </html>
CSS编程
html,body{ margin: 0; height: 100%; } body{ display: flex; justify-content: center; align-items: center; background: #263238; } section { width: 650px; height: 300px; padding: 10px; position: relative; display: flex; align-items: center; justify-content: center; /* 红色边框仅做提示 */ border: 2px solid red; } span{ width : 96px; height: 96px; border: 10px solid transparent; border-radius: 50%; display: flex; align-items: center; justify-content: center; position: relative; border-bottom-color: #FF3D00; border-top-color: #FF3D00; animation: rotation 1s linear infinite; } span::after{ position: relative; content: ''; display: inline-block; width: 72px; height: 72px; border-radius: 50%; border: 10px solid transparent; border: 10px solid #fff; } @keyframes rotation { 0% { transform: rotate(0deg) } 100% { transform: rotate(360deg) } }
动画的核心部分就是span和span::after,section仅做为提示框。微信
将span元素设置为学习
width : 96px; height: 96px; border: 10px solid #fff;
效果图以下
flex
span::after伪元素设置为:动画
注:红色部分即为span::after,为便于观察才设置为红色
ui
span::after设置spa
border: 10px solid white;
注:3d
span
border-bottom-color: #FF3D00; border-top-color: #FF3D00;
效果图以下
span和span::after
border-radius: 50%;
效果图以下
span
border: 10px solid transparent;
为span添加动画
animation: rotation 1s linear infinite;
/*动画实现*/ @keyframes rotation { 0% { transform: rotate(0deg) } 100% { transform: rotate(360deg) }
效果图以下
学习来源:
文章仅做为学习笔记,记录从0到1的一个过程。但愿对您有所帮助,若有错误欢迎小伙伴指正~
我是海轰ଘ(੭ˊᵕˋ)੭,若是您以为写得能够的话,请点个赞吧
写做不易,「点赞」+「收藏」+「转发」
谢谢支持❤️