【发布时间】:2019-04-24 03:44:20
【问题描述】:
所以我得到了这个 css 动画,其中 5 个圆圈在一些文本之间旋转;
(大小不一)
#circle .circle1{
position: absolute;
top: 1330px;
left: 0;
right: 0;
margin-left: auto;
margin-right: auto;
height: 500px;
width: 500px;
border-radius: 50%;
display: inline-block;
border-top: 20px solid #5E0DAC;
border-right: 20px solid transparent;
border-bottom: 20px solid #5E0DAC;
border-left: 20px solid transparent;
animation-name: circle1;
animation-duration: 18s;
animation-iteration-count: infinite;
animation-delay: -1s;
animation-timing-function: linear;
}
#circle .circle2{
position: absolute;
top: 1380px;
left: 0;
right: 0;
margin-left: auto;
margin-right: auto;
height: 400px;
width: 400px;
border-radius: 50%;
display: inline-block;
border-top: 20px solid #B90091;
border-right: 20px solid #B90091;
border-bottom: 20px solid transparent;
border-left: 20px solid transparent;
animation-name: circle2;
animation-duration: 8s;
animation-iteration-count: infinite;
animation-delay: -1s;
animation-timing-function: linear;
}
#circle .circle3{
position: absolute;
top: 1480px;
left: 0;
right: 0;
margin-left: auto;
margin-right: auto;
height: 200px;
width: 200px;
border-radius: 50%;
display: inline-block;
border-top: 20px solid #5E0DAC;
border-right: 20px solid transparent;
border-bottom: 20px solid #5E0DAC;
border-left: 20px solid transparent;
animation-name: circle1;
animation-duration: 6s;
animation-iteration-count: infinite;
animation-delay: -1s;
animation-timing-function: linear;
}
#circle .circle4{
position: absolute;
top: 1430px;
left: 0;
right: 0;
margin-left: auto;
margin-right: auto;
height: 300px;
width: 300px;
border-radius: 50%;
display: inline-block;
border-top: 20px solid #5E0DAC;
border-right: 20px solid #5E0DAC;
border-bottom: 20px solid transparent;
border-left: 20px solid transparent;
animation-name: circle1;
animation-duration: 13s;
animation-iteration-count: infinite;
animation-delay: -1s;
animation-timing-function: linear;
}
#circle .circle5{
position: absolute;
top: 1530px;
left: 0;
right: 0;
margin-left: auto;
margin-right: auto;
height: 100px;
width: 100px;
border-radius: 50%;
display: inline-block;
background-color: #B90091;
}
@keyframes circle2{
0% {transform: rotate(-360deg)}
}
@keyframes circle1{
0% {transform: rotate(360deg)}
}
<html>
<div id="circle">
<div class="circle1"></div>
<div class="circle2"></div>
<div class="circle3"></div>
<div class="circle4"></div>
<div class="circle5"></div>
</div>
</html>
使该动画具有响应性的最简单方法是什么? 为此,我必须在媒体查询中编辑每个像素的高度和宽度。
询问是否有更简单的方法。
干杯
【问题讨论】:
-
css 媒体查询。
-
当然可以,但是对于每个屏幕高度和宽度,我都必须以 px 换 px。我的问题是,是否有一个简单的解决方法。
-
每个圆圈的大小和它们旋转的文本之间的关系是什么?例如,圆圈 1 是否总是文本大小的两倍?
-
您好,您能否将所有内容都包含在 sn-p 编辑器中,以便我们可以准确地重现您看到的内容?当您编辑问题时,它将是文本编辑器上的
<>按钮。 -
@Ypoulakas 每个圆圈的大小相差 100 像素。所以顶部有 50px 的差异:(绝对高度)
标签: css responsive-design css-position responsive absolute