0
如圖這裏遇到麻煩的外層div內水平對齊紡絲圓動畫(載帶的「自旋面板」 ID在div內)(的「加載」 ID)
:https://codepen.io/depaolif/pen/MoYwrP水平對齊的div
有沒有人知道爲什麼margin: auto
在這種情況下不會像通常那樣工作?
HTML:
<div id="loading">
Loading account info
<div id="spin-panel">
<span id="loading8-1">
<span id="CircleBottom"><span class="ball"></span></span>
</span>
<span id="loading8-2">
<span id="CircleMiddle"><span class="ball"></span></span>
</span>
<span id="loading8-3">
<span id="CircleTop"><span class="ball"></span></span>
</span>
</div>
</div>
SCSS:
@keyframes cwSpin {
0%{transform:rotate(0deg);}
100%{transform:rotate(360deg);}
}
#loading {
text-align: center;
margin-top: 40vh;
font-size: 40px;
width: 100vw;
#spin-panel {
width: 50%; // this doesn't make a difference
margin: 0 auto;
#loading8-1, #loading8-2, #loading8-3 {
display:block;
position:absolute;
margin:30px 0 0 100px;
width:80px;
height:80px;
animation: cwSpin 1s linear 0s infinite;
#CircleBottom, #CircleMiddle, #CircleTop {
display:block;
position:absolute;
width:100px;
height:100px;
border-radius:100px;
.ball {
width:20px;
height:20px;
display:block;
position:absolute;
background-color:#06C;
border-radius:20px;
margin:0 0 0 45px;
}
}
#CircleBottom {
transform:rotate(0deg);
}
#CircleMiddle {
transform:rotate(50deg);
}
#CircleTop {
transform:rotate(100deg);
}
}
}
}
添加在#旋面板位置:相對; – PlayerWet
您是否已選擇我的答案作爲解決方案?如果是這樣,我很好奇爲什麼? –