当前位置:首页 > 网站应用

css3实现不断旋转动画加载,并弹性布局显示

cjw1233年前 (2023-11-01)网站应用6940
<style>
body{
background:#34495e;
display:flex;
justify-content:center;
align-items:center;
height:100vh;
}
.loading{
position:relative;
width:200px;
height:200px;
border-top:10px solid #e74c3c;
border-radius:50%;
animation:rotate 2s linear infinite;
}
.loading::before{
position:absolute;
top:-10px;
left:0;
content:'';
width:200px;
height:200px;
border-top:10px solid #e67e22;
border-radius:50%;
transform:rotate(120deg);
}
.loading::after{
position:absolute;
top:-10px;
left:0;
content:'';
width:200px;
height:200px;
border-top:10px solid #3498bd;
border-radius:50%;
transform:rotate(240deg);
}
span{
position:absolute;
width:200px;
height:200px;
line-height:200px;
text-align:center;
color:white;
animation:rotateR 2s linear infinite;
}
@keyframes rotate{
to{
 transform:rotate(360deg);
}
}
@keyframes rotateR{
to{
 transform:rotate(-360deg);
}
}
</style>
<div class="loading">
	<span>loading</span>
</div>
<!--
伪元素大小只受内容影响,用定位的方式脱离文档流,所以要用positon,再用top调整位置,此时3个弧重合在一起。再旋转120、240,各自占1/3份
再加动画,省from
此时,span也跟着转,使其正中显示(垂直、水平居中),再加个反之转的动画,平衡之
最后,再之整个在正中显示,即弹性布局-->


扫描二维码推送至手机访问。

版权声明:本文由追求完美发布,如需转载请注明出处。

本文链接:https://cjw123.com/blog/?id=27

标签: html
分享给朋友:

相关文章

html meta标签屏蔽搜索引擎的用法

html页面中的 meta 标签可以用来识别搜索引擎的蜘蛛类型,可以规定meta标签所在的html页面是否被蜘蛛抓取,下面是这个meta标签的用法,大家可以借鉴一下。搜索引擎的 meta 标签的解析下面是meta标签对搜索引擎的解析<meta name='robot…

8 种在 CSS 中隐藏元素的方法汇总

作为 Web 开发人员,我们经常遇到需要隐藏网页上的元素的情况。在本文中,我们将分享8 种在 CSS 中隐藏元素的方法,每种方法都有优点和注意事项。1.Opacity and Filter: Opacity隐藏元素最简单的方法之一是调整其不透明度。opacity 属性允许我们通过将其值设置为 0 来…

css3动画实现滚动字,类似航班信息,超出滚动,不超出不滚动

文字走马灯,手机的弹幕等等。js可以动态的计算宽度,但js做动画需要定时器,很不方便。其实就是里外容器对向滚动,滚动的值为里外容器宽度的差值,如果里容器与外容器等宽,那么差值就为0,视觉上是没有滚动的,就像第一条数据;如果里容器宽度比外容器宽,里容器向左滚动的距离比外容器向右滚动的距离大,就会形成滚…

css li超出自动隐藏代码

<style>  <!--  li {      width:200px;      white-space:nowrap;  &n…

自由控制灯光

<!DOCTYPE html> <html lang="en"> <head>     <meta charset="UTF-8">…

彩色流转文字代码

根据自己需求修改代码,点击运行预览效果!<style>     #nr{font-size:15px; margin: 0;background: -webkit-linear-gradient(left,#ffff…

发表评论

访客

看不清,换一张

◎欢迎参与讨论,请在这里发表您的看法和观点。